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

George Kalpakas commented on PDFBOX-1228:
-----------------------------------------

Hi, 

I don't know if this helps at all, but I noticed that the described problem is 
caused by the document's being encrypted with an owner password. If (somehow) 
one was able to remove the protection, then the saved document would be an 
exact copy of the original. 

So, I guess it is good as it is, so that <PDDocument.save(...)> won't decrypt a 
password protected document. (One could have invoked something like 
<doc.openProtection(new StandardDecryptionMaterial("<owner_pass>"))> before 
saving the document in order to decrypt it). 
On the other hand, I think it would be "nice", if the user would be somehow 
informed (by means of an Exception ??), that he is trying to save an encrypted 
document, without decrypting it first (unless there are any cases where it is 
desirable for the user to do so - nothing crosses my mind, but being new to all 
this PDF stuff, that doesn't tell much). 

Well, that was it. 
I hope my remarks will be of some use to someone more knowledgeable !

GK
                
> PDocument corrupts file
> -----------------------
>
>                 Key: PDFBOX-1228
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1228
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.6.0, 1.7.0
>         Environment: Ubuntu 10.04 amd64
>            Reporter: Josh Nankin
>            Priority: Critical
>             Fix For: 1.6.0, 1.7.0
>
>         Attachments: in.pdf
>
>
> I have a file (attached) that when loaded with PDocument.load and then saved 
> to another location simply saves as a blank PDF.  The number of pages is 
> correct, but when opened in Acrobat, all the page names are corrupted and the 
> pages are blank.
> Here's the code:
>         PDDocument doc = PDDocument.load("/home/jnankin/Desktop/in.pdf");
>         doc.save("/home/jnankin/Desktop/out.pdf");
>         doc.close();
> Please advise.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to