Skip to Main Content

Java User Groups

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Access Permissions not reflecting on PDF Document Restriction Summary using PDFBox

User_40C6QFeb 23 2022

Hi All, I'm using PDFBox for PDF encryption. There is a requirement to set all the Document Restriction Summary fields to "Not Allowed". I'm using the below code to set the permissions. But these are not reflecting on PDF Document Restriction Summary. I'm missing anything here. Is it possible to change the field values with pdfbox? pls help.
AccessPermission ap = new AccessPermission();
ap.setCanAssembleDocument(false);
ap.setCanExtractContent(false);
ap.setCanExtractForAccessibility(false);
ap.setCanFillInForm(false);
ap.setCanModify(false);
ap.setCanModifyAnnotations(false);
ap.setCanPrint(false);
ap.setCanPrintDegraded(false);
ap.setReadOnly();
StandardProtectionPolicy spp = new StandardProtectionPolicy(userPassword, globalPassword, ap);
spp.setPermissions(ap);
spp.setEncryptionKeyLength(128);
pddocument.protect(spp);
pddocument.save(outputpdf);
pddocument.close();
image.png

Comments

Post Details

Added on Feb 23 2022
0 comments
824 views