'Access Permissions not reflecting on PDF Document Restriction Summary using PDFBox

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.

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();

PDF Document Restriction Summary



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source