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

Tilman Hausherr commented on PDFBOX-2447:
-----------------------------------------

Well, I could add to the javadoc not to call it if the document has been closed.

The problem with getDocumentCatalog() isn't easy. I also thought about adding 
it to protect(), but that one doesn't do anything with the document itself at 
that time. My old thought to call getDocumentCatalog() in load() and 
loadNonSeq() is probably also wrong, because the PDF could be encrypted and 
have the objects in an object stream.

My current thought is to change save() so that it checks document for null and 
not documentCatalog. But I wonder why this wasn't done in the first place, 
maybe there was a reason? ([~jahewson] in PDFBOX-1926)

> "Cannot save a document which has been closed" when encrypting
> --------------------------------------------------------------
>
>                 Key: PDFBOX-2447
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2447
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.0
>         Environment: java7 deb7
>            Reporter: Ralf Hauser
>         Attachments: patch2447.txt, patch2447a.txt, patch2447b.txt
>
>
> InputStream content = ...;
>                     int keyLength = 256;
>                     AccessPermission ap = new AccessPermission();
>                     StandardProtectionPolicy spp = new 
> StandardProtectionPolicy(
>                             symmPw, symmPw, ap);
>                     spp.setEncryptionKeyLength(keyLength);
>                     document.protect(spp);
>                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
>                     document.save(baos);
> in the save() the above mentioned exception is thrown (wasn't with the 
> 2013-11 snapshot)



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

Reply via email to