You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2021/02/20 12:48:00 UTC

[jira] [Closed] (PDFBOX-5096) Is there a way for PDFBox to decrypt encrypted pdf files without providing the password?

     [ https://issues.apache.org/jira/browse/PDFBOX-5096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr closed PDFBOX-5096.
-----------------------------------
    Resolution: Won't Do

> Is there a way for PDFBox to decrypt encrypted pdf files without providing the password?
> ----------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5096
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5096
>             Project: PDFBox
>          Issue Type: Wish
>            Reporter: Ling Hock Hin, Daniel
>            Priority: Major
>         Attachments: function.txt, test_e_file.pdf
>
>
> My application needs to remove metadata of pdf files when uploaded. When attempting to  load and remove metadata of encrypted pdf files, I get the logs below.
>  
>  at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]Caused by: java.lang.IllegalStateException: PDF contains an encryption dictionary, please remove it with setAllSecurityToBeRemoved() or set a protection policy with protect() at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1367) ~[pdfbox-2.0.22.jar:2.0.22] at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1319) ~[pdfbox-2.0.22.jar:2.0.22] at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1357) ~[pdfbox-2.0.22.jar:2.0.22]
>  
> Tried to use the code below but it does not seem to work.
> PDDocument document = PDDocument.load(documentBytes);
>  if (document.isEncrypted()) {
>  document.setAllSecurityToBeRemoved(true);
>  }
>  
> Appreciate your advice.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org