[
https://issues.apache.org/jira/browse/PDFBOX-2206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14062280#comment-14062280
]
John Hewson commented on PDFBOX-2206:
-------------------------------------
Yeah, we need to fix this problem. There's a lot of lazy loading code in PDFBox
which would be better following RAII, i.e. the work is done when the
constructor is called. There's nothing that can be done with a PDDocument
without calling getDocumentCatalog(), even adding a signature, so yes, let's
call it in the constructor.
> Cannot save a document which has been closed
> --------------------------------------------
>
> Key: PDFBOX-2206
> URL: https://issues.apache.org/jira/browse/PDFBOX-2206
> Project: PDFBox
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.0.0
> Reporter: simon steiner
> Fix For: 2.0.0
>
>
> Any pdf gives:
> java -jar ~/pdf-box-svn/app/target/pdfbox-app-2.0.0-SNAPSHOT.jar
> WriteDecodedDoc x.pdf
> Exception in thread "main" java.io.IOException: Cannot save a document which
> has been closed
> at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1230)
> at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1216)
> at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1204)
> at
> org.apache.pdfbox.tools.WriteDecodedDoc.doIt(WriteDecodedDoc.java:125)
> at
> org.apache.pdfbox.tools.WriteDecodedDoc.main(WriteDecodedDoc.java:191)
> at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:97)
--
This message was sent by Atlassian JIRA
(v6.2#6252)