Hello all,

I have a collection of PDFs I'm extracting text from programmatically, and
some of them are encrypted.  All of them can be opened in OS X's Preview
without supplying a password, but when decrypting with PDFBox, a small
portion of result in an exception on decryption:

Exception in thread "main"
org.apache.pdfbox.exceptions.CryptographyException: Error: The supplied
password does not match either the owner or user password in the document.
at
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:231)
at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1111)
...

This happens both with

doc.openProtection(new StandardDecryptionMaterial(""));

and

doc.decrypt("");

(not that I'm sure there's a difference).  Is there some magic that Preview
is doing to decrypt the document, or am I just hosed?  Any help would be
greatly appreciated.  Thanks!

Gary LosHuertos
Arc90

Reply via email to