Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.3
-
None
Description
In the CreateEmptySignatureForm example, adding
signatureField.setValue(new PDSignature());
before saving brings this
Exception in thread "main" java.lang.UnsupportedOperationException: not implemented
at org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField.constructAppearances(PDSignatureField.java:237)
at org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:226)
at org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField.setValue(PDSignatureField.java:121)
at org.apache.pdfbox.examples.signature.CreateEmptySignatureForm.main(CreateEmptySignatureForm.java:84)
Although there's nothing to construct, visual signing is a different area of PDFBox.
What does work is this:
signatureField.getCOSObject().setItem(COSName.V, new PDSignature());
I wanted to add this line because this would make it possible to sign this specific field with PDFBox, due to the findSignatureField() method in PDDocument, which would allow to pre-fill a PDSignature object.