I can see the existing permissions on a PDF file via this:
PDDocument doc = basicOpen("c://example_pdf_doc.pdf");
IAccessPermissions perms = doc.getAccessPermissions();
How do you change the access permissions? I want to remove the ability to copy and print (or to put it another way, I want to add the permission restriction to prevent copy and print).
I thinking it might be something like this, but I don't know what values to put in the attribute. Maybe this isn't even the correct way to do this.
COSDictionary cosDict = COSDictionary.create();
Setting permissions on a document is not just a one liner.
- set up a dictionary for use as /Encrypt in the trailer
- set the new permissions in the dict
- provide a SecurityHandler
- compute NEW keys from the passwords
- write the complete document from scratch
This is a rough overview, involving some more or less difficult steps (well documented in the PDF spec).
While everything you need is in place with jPod, there is currently no example available. I will change this with release 5.0 (this month).
Ok, more complex then I thought. Are you saying that in release 5.0 that you will have an example of modifying these attributes (copy/print allowed)? If so, then it would be worth me waiting for your example.
I will try my best.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.