You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Mark Goldstein <kv...@att.net> on 2011/09/22 23:30:40 UTC
Fetching pdf AccessPermission
I am trying to programmatically recognize a pdf file that has an owner password and that requires the password in order for a viewer to open the file.
This sequence of code does not work:
PDDocument pd = PDDocument.load(filePath);
Boolean password = pd.isEncrypted(); // returns TRUE
SecurityHandler security = pd.getSecurityHandler(); // returns NULL -- WHY?
AccessPermission ap = pd.getCurrentAccessPermission();
Boolean canExtract = ap.canExtractContent(); // returns TRUE
An earlier thread (Re: Fwd: PDF Permissions) implies that if the document has a non-null SecurityHandler then canExtract would be FALSE, and so in this example I am retrieving the owner permissions.
Why is this the case? Am I missing a step in attempting to fetch the user permissions?