[ 
https://issues.apache.org/jira/browse/PDFBOX-3010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14948129#comment-14948129
 ] 

Maruan Sahyoun commented on PDFBOX-3010:
----------------------------------------

The current code was done to support signing a PDF document which was a very 
important addition to PDFBox. OTOH there are several issues with the current 
code so I suggest to fix it as Rafael suggested and look at making it a more 
general solution in a later (2.1.0 ?) release.

Some of the issues are:
- incremental save only works for signatures and doesn't respect certificates 
such as Adobe Extended Usage Rights
- {{prepareNonVisualSignature}} clears the AcroForm DR 
{{acroForm.setDefaultResources(null)}} which is not good if there are other 
form fields
- visual/nonVisualSignature should move into the {{interactive.forms}} package 
and be handled within the signature field

WDYT?

> SignatureOptions object must not be closed before calling saveIncremental in 
> trunk's CreateVisibleSignature example
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3010
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3010
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>             Fix For: 2.0.0
>
>
> As reported by Rafael on the user mailing list:
> {code}
> 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.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1138)
>       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.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1039)
>       at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:409)
>       at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1289)
>       at 
> org.apache.pdfbox.pdmodel.PDDocument.saveIncremental(PDDocument.java:1118)
>       at 
> org.apache.pdfbox.examples.signature.CreateVisibleSignature.signPDF(CreateVisibleSignature.java:169)
>       at 
> org.apache.pdfbox.examples.signature.CreateVisibleSignature.main(CreateVisibleSignature.java:261)
> {code}
> He got rid of the exception by moving options.close() after 
> doc.saveIncremental(fos))



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to