pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael <raf...@gmail.com>
Subject SignatureOptions object must not be closed before calling saveIncremental in trunk's CreateVisibleSignature example
Date Wed, 07 Oct 2015 17:59:24 GMT

Otherwise, you will get:

INFO: stream returning started, size= 11019
Exception in thread "main" java.io.IOException: COSStream has been closed
and cannot be read. Perhaps its enclosing PDDocument has been closed?
at org.apache.pdfbox.cos.COSStream.checkClosed(COSStream.java:78)
at org.apache.pdfbox.cos.COSStream.createRawInputStream(COSStream.java:126)
at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:372)
at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:158)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:538)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:450)
at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:409)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1289)
at CreateVisibleSignature.signPDF(CreateVisibleSignature.java:169)
at CreateVisibleSignature.main(CreateVisibleSignature.java:256)

Moreover. Two questions:

1) Once I got rid of that IOE (by moving options.close() after
doc.saveIncremental(cos)), I found that the example produces a corrupted
signed pdf. The Signature Panel says:

Rev. 1: Signed by signer name
Signature is invalid:
There are errors in the formatting or information contained in this
signature (support information: SigDict /Contents illegal data)
Signer's identity has not yet been verified
Signing time is from the clock on the signer's computer.
Last checked: 2015.10.07 19:41:53 +02'00'
Field: Signature1 on page 1

I couldn't find the reason for that. Any ideas about what's wrong with the
example apart from that options closing?

2)  After a while I decided to create my own example (SignPDFPoC) by
combining trunk CreateSignature and CreateVisibleSignature. With my
example, I get a valid pdf after signing. Strange, cause it is just a "mix"
of those 2 trunk examples. However, the Signature Panel always shows:

Field: Signature1 on page 1

I thought that PDVisibleSignDesigner.signatureFieldName was used for that
purposes. But it does not seem to be the case. Moreover, for invisible
signatures, no PDVisibleSignDesigner is used, so there must be a different

So the question is: how can I set the value of "Field" shown by Signature
Panel for both invisible and visible signatures?

Br, Rafael

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message