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?