Hi,
I am adding a signature field to a pdf generated by another application
using this (simplified and abridged code):
try (PDDocument pdDocument = Loader.loadPDF(pdfBytes)) {
PDPage pdPage = pdDocument.getPage(0);
PDAcroForm acroForm = pdDocument.getDocumentCatalog().getAcroForm();
String defaultAppearanceString = "/Helv 0 Tf 0 g";
acroForm.setDefaultAppearance(defaultAppearanceString);
// Create empty signature field, it will get the name "SignatureX"
PDSignatureField signatureField = new PDSignatureField(acroForm);
PDAnnotationWidget widget = signatureField.getWidgets().get(0);
Rectangle2D rect = new Rectangle2D.Float(315, 368, 224, 16);
widget.setRectangle(rect);
widget.setPage(pdPage);
widget.setPrinted(true);
pdPage.getAnnotations().add(widget);
acroForm.getFields().add(signatureField);
...
}
The signature field works fine in Adobe Acrobat Reader.
The problem is that the pdf will be displayed/processed by another
in-house application.
The developers tell me that "Rect" has to be defined lower left (x,y)
and upper right (x,y).
When I open the pdf with PDFBox debugger I see "Rect 315 472 540 457"
for the signature field, so it seems to be defined as upper left (x,y)
and lower right (x,y) coordinates.
I took a look at the PDF 1.7 specification and the examples seem to
follow the lower left/upper right style, while the text suggests upper
left/lower right style (I may very well be misunderstanding the spec,
because I have basically no knowledge of the pdf format). I guess both
are allowed?
Is there a way to generate signature field with lower left/upper right
coordinates with PDFBox?
Thanks and kind regards,
Pascal
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]