addSignatureFieldTopLeft method
Adds a signature field using top-left coordinates.
Implementation
PdfDocument addSignatureFieldTopLeft({
required int pageNumber,
required double left,
required double top,
required double width,
required double height,
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 bounds = _rectFromTopLeft(
page,
left: left,
top: top,
width: width,
height: height,
);
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;
}