Details
Description
To evaluate Apache's PDFBox library, I created a simple sample based on trunk CreateVisibleSignature and CreateSignature. The reason for combining those 2 samples was that each provided features that I wanted to test. The created "mix" example is in SignPDFPoC.java.
The initial problem I faced is related to the sentence closing the SignatureOptions right before calling saveIncremental on the relevant document object. Once I moved the 'options.close()' sentence to a better position (see PDFBOX-3010), SignPDFPoC started to produce correct output, signed, pdf files. And once I added my test certificate chain to the trusted identities, the signature validates correctly.
After examining the produced, signed, pdf, both via Signature Panel on Adobe Reader and via the file itself (binary), I got stuck on "Field: Signature1". I initially supposed that PDVisibleSignDesigner.signatureFieldName was used for that purpose. But it does not seem to be the case. Moreover, for invisible signatures, no PDVisibleSignDesigner is used, so there must be a different way.
So I decided to build and execute the original CreateVisibleSignature from trunk to check whether it did something different regarding "Field: Signature1" that I could have missed in my "mix" example. This is how I found out that the trunk CreateVisibleSignature example produces incorrect pdf files. Or I must be doing something terribly wrong that, in advanced, I apologize for.
I attach complete zip files for reproducing the observation:
- mix_example_correct_signed_pdf
- trunk_createvisiblesignature_example_incorrect_signed_pdf
Simply add the .zip suffix, unpack and run the corresponding _execute.sh script. There are already .class files available. The needed dependencies are also present. As test p12 containing a certificate chain, test pdf file and test image.
Attachments
Attachments
Issue Links
- is related to
-
PDFBOX-3010 SignatureOptions object must not be closed before calling saveIncremental in trunk's CreateVisibleSignature example
- Closed