Hi, thanks for the reply. These are new files, ie, i'm creating them from a memory structure using Apache FOP (legacy code), PDFBox was added recently to post-process the documents in order to make them read-only .
The crucial point is that all of the pdfs (200-300 per day) are created and locked down in the same way and yet in the last couple of months I've had two instances of a file being password protected at the user level. Steve Lindsey Adam Nichols <[email protected]> 16/09/2011 17:15 Please respond to [email protected] To [email protected] cc Subject Re: PDF is wrongly password protected Was the file password protected before you started? There's a method to remove all encryption (I think it's in PDDocument, if I recall correctly). If you start with that method, you can be certain that any old encryption was removed, and all that will remain is what is in your code below. On 09/16/2011 09:00 AM, [email protected] wrote: > I am using the code below to semi-protect the generated PDFs, hundreds of > these are being generated but in the past three months I have (just) two > instances where the PDF cannot be opened (in adobe or pdfxchange) because > it prompts for a password. > > > ----------------------------------------------------------------- > public void lockDown(String owner_pwd) throws > BadSecurityHandlerException { > AccessPermission ap = > document.getCurrentAccessPermission(); > logger.info("locking down "); > ap.setCanModify(false); > ap.setCanAssembleDocument(false); > ap.setCanExtractContent(false); > ap.setCanFillInForm(false); > ap.setCanModifyAnnotations(false); > ap.setReadOnly(); > StandardProtectionPolicy policy = new > StandardProtectionPolicy(owner_pwd, null, ap); > //policy. > document.protect(policy); > logger.info("locked"); > } > ----------------------------------------------------------------- > > I'm failrly sure (though I could be wrong) that the application is not > responsible for, as you can see, the user password is hard-coded and null. > > Any ideas > > Steve Lindsey >

