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().setCanExtractForAccessibility(false);

                  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

Reply via email to