Thanks Adam, but that's exactly what I did and I'm still getting the same exception : 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:1109)

Best regards ,
Hesham

--------------------------------------------------
From: <a...@swmc.com>
Sent: Friday, October 30, 2009 5:53 PM
To: <pdfbox-users@incubator.apache.org>
Cc: <pdfbox-users@incubator.apache.org>
Subject: Re: PDF Permissions

Here are the basics:
       PDDocument doc = null;
       try {
           doc = PDDocument.load(someFile);
           StandardDecryptionMaterial sdm = new
StandardDecryptionMaterial("yourPasswordGoesHere");
           doc.openProtection(sdm);
           // use the document like normal
       } catch(...) {
           // decryption error
       } finally {
           if(doc != null)
               doc.close();
       }




"Hesham G." <heshamgne...@gmail.com>
10/30/2009 04:37
Please respond to
pdfbox-users@incubator.apache.org


To
<pdfbox-users@incubator.apache.org>
cc

Subject
Re: PDF Permissions






I am having problems with encrypted PDFs too. I don't know but I think
there
are things wrong with the Encryption / Decryption classes.

Best regards ,
Hesham


Reply via email to