Thank you so much Tilman, that got me where I need to go. Thank you _____________________________________________________ Keith Wood | Applications Program Lead | United Guaranty Corporation 300 N. Greene St. | Greensboro, NC 27401
Phone: 336.334.8547 [email protected] www.ugcorp.com ____________________________ -----Original Message----- From: Tilman Hausherr [mailto:[email protected]] Sent: Wednesday, July 20, 2016 5:02 PM To: [email protected] Subject: Re: Changing "Content Copying" permission Am 20.07.2016 um 21:37 schrieb Keith R Wood: > I am trying to change the attributes "Content Copying" and "Content Copying > for Accessibility" on a PDF received from a third party. > > I'm not sure if this is possible, but am unable to find anything that says it > is not allowed. > > Here is what I can tell you about the PDF. > > Both "Content Copying and Content Copying for Accessibility are currently set > to "Allowed". > > The PDF is NOT read only. > > The "Owner Permission" is set to false (which I am thinking may be key). > > I set both attributes to false, I then save the document and close the > document. > > The time stamp of the document gets updated, but the attributes remain > unchanged. > > Below is sample code and output: > > PDDocument doc = PDDocument.load(pdfFile); > canExtract = > doc.getCurrentAccessPermission().canExtractContent(); > canExtractFA = > doc.getCurrentAccessPermission().canExtractForAccessibility(); > canExtract_owner = > doc.getCurrentAccessPermission().getOwnerAccessPermission().canExtractContent(); > canExtractFA_owner = > doc.getCurrentAccessPermission().getOwnerAccessPermission().canExtractForAccessibility(); > readOnly = > doc.getCurrentAccessPermission().isReadOnly(); > ownerPermission = > doc.getCurrentAccessPermission().isOwnerPermission(); > > > > doc.getCurrentAccessPermission().setCanExtractForAccessibility(false); > > doc.getCurrentAccessPermission().setCanExtractContent(false); > doc.getCurrentAccessPermission().getOwnerAccessPermission().setCanExtractContent(false); > > doc.getCurrentAccessPermission().getOwnerAccessPermission().setCanExtr > actForAccessibility(false); if ap is your access permission, then do this before saving: StandardProtectionPolicy spp = new StandardProtectionPolicy("secretpassword", "", ap); spp.setEncryptionKeyLength(256); // not really needed... document.protect(spp); You can also leave the default key length... PDF security for permissions only (i.e. empty user psw) is not real security anyway. Tilman > > doc.save(pdfFile); > doc.close(); > > > > canExtract-true, canExtractFA- > > Thank you > _____________________________________________________ > Keith Wood | Applications Program Lead | United Guaranty Corporation > 300 N. Greene St. | Greensboro, NC 27401 > > Phone: 336.334.8547 > [email protected]<mailto:[email protected]> > www.ugcorp.com<http://www.ugcorp.com/> > ____________________________ > > ---------------------------------------------------------------------- > ---------------------------------------------------------------------- > ---- United Guaranty is a marketing term for United Guaranty > Corporation and its subsidiaries. This communication from United Guaranty > Corporation or its subsidiary is directed to and is for the use of the > individual or entity to which it is addressed. It may contain information > that is confidential and exempt from disclosure under applicable law. If you > are not the intended recipient, you are hereby notified that any > distribution, dissemination, or copy of this communication is strictly > prohibited. If you have received this communication in error, please contact > the sender immediately, and then delete or destroy the material in its > entirety. United Guaranty Corporation and its subsidiaries > 230 North Elm Street > Greensboro, NC 27401 > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] ---------------------------------------------------------------------- -------------------------------------------------------------------------- United Guaranty is a marketing term for United Guaranty Corporation and its subsidiaries. This communication from United Guaranty Corporation or its subsidiary is directed to and is for the use of the individual or entity to which it is addressed. It may contain information that is confidential and exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any distribution, dissemination, or copy of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately, and then delete or destroy the material in its entirety. United Guaranty Corporation and its subsidiaries 230 North Elm Street Greensboro, NC 27401 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

