0

I'm trying to extract access permissions with Apache PDFBox. The problem is that all the permissions are set to true. For example, I extracted the Document Assembly property as follow:

PDDocument doc = PDDocument.load(new File(filePath));
AccessPermission ap = doc.getCurrentAccessPermission();
boolean documentAssembly = ap.canAssembleDocument();

The documentAssembly variable is true. However, when i check the permissions on Adobe reader I found that the document assembly property is set to not allowed: enter image description here

Is there a way to extract all the correct informations, as in the above image?

  • Can you share the document? Maybe there are additional permissions, see https://stackoverflow.com/a/30533786/535646 (IIRC this isn't supported by PDFBox) – Tilman Hausherr Nov 19 '20 at 14:24
  • Here it is: http://www.filedropper.com/provaafter – Luca Nassano Nov 19 '20 at 14:52
  • Part of the problem may be incorrect use of PDFBox. Try this: PDDocument doc = PDDocument.load(new File(filePath)); AccessPermission ap = new AccessPermission(doc.getEncryptionDictionary().getPermissions()); boolean documentAssembly = ap.canAssembleDocument(); – Paul Jowett Mar 10 '21 at 07:24

1 Answers1

2

What you see on the security tab is a summary of all document restrictions that apply. In particular there are some restrictions which only depend on the PDF viewer you use. If I look at the same dialog in Adobe Acrobat (not Reader), for example, I see

screen shot

Obviously PDFBox does not know which viewer you will use. So it cannot consider viewer specific restrictions.

mkl
  • 90,588
  • 15
  • 125
  • 265
  • For more details see [this answer](https://stackoverflow.com/a/65021738/1729265). – mkl Nov 26 '20 at 12:04