[
https://issues.apache.org/jira/browse/PDFBOX-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219921#comment-13219921
]
Thomas Chojecki commented on PDFBOX-1228:
-----------------------------------------
I never test it, but what happen if you just add the encryption password as
george posted. As <owner password> just use an empty string, so that it would
look like this new StandardDecryptionMaterial("").
If this will help, you can try to ask the pddocument if it is encrypted and try
to open it with the empty string. if this fail, throw an exception and inform
the user the document is protected and could not be decrypted.
On the other hand, the pdfbox shouldn't destroy documents if the user use the
save method on encrypted documents without decrypting it.I would prefere to
open the issue and do some check while saving a document. better throw an
exception and inform the user that something is going wrong while saving so
that he has a chance to react (eg. in unit tests).
> 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
> Assignee: Andreas Lehmkühler
> Priority: Critical
> 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