addSignatureField method
PdfDocument
addSignatureField({
- required int pageNumber,
- required PdfRect bounds,
- required String fieldName,
- void drawAppearance(
- PdfGraphics graphics,
- PdfRect bounds
Adds a signature field at the given bounds.
Implementation
PdfDocument addSignatureField({
required int pageNumber,
required PdfRect bounds,
required String fieldName,
void Function(PdfGraphics graphics, PdfRect bounds)? drawAppearance,
}) {
final pageIndex = pageNumber - 1;
if (pageIndex < 0 || pageIndex >= pdfPageList.pages.length) {
throw RangeError.index(pageIndex, pdfPageList.pages, 'pageNumber');
}
final page = pdfPageList.pages[pageIndex];
final widget = PdfAnnotSign(rect: bounds, fieldName: fieldName);
if (drawAppearance != null) {
final g = widget.appearance(this, PdfAnnotAppearance.normal);
drawAppearance(g, PdfRect(0, 0, bounds.width, bounds.height));
}
PdfAnnot(page, widget);
return this;
}