We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to find out about PDF permissions

Hi,


How can we get a PDF file’s Security restrictions information? I want to know if a PDF file’s “Page Extraction” is Allowed or Not Allowed. How can this be done?

Thanks,
Suresh

Hi Suresh,


Thanks for your inquiry. I’m afraid currently requested feature is not supported completely I’ve logged an enhancement ticket as PDFNEWNET-35805 in our issue tracking system for the requirement. We will notify you via this forum thread as soon as its resolved.

We are sorry for the inconvenience faced.

Best Regards,

Hi Suresh,


Thanks for your patience.

We have further investigated the issue PDFNEWNET-35805 reported earlier and it does not seem to be a bug. In order to read the permissions, please try using the following code line.

Permissions test = (Permissions)document.Permissions;

Page extraction option is not able to be set by user. To allow this feature user needs to remove security from the file completely. There is a link that describes how to extract pages. 

Also please note that Pdf reference does not provide single page extraction permission flag. The Page extraction is always set to Not allowed while encrypted document is opened without Owner password. Actually encryption allows you to remove permissions compared to what is allowed for an unencrypted document. You get the maximum number of permissions by simply not encrypting the document. Also please keep in mind what Acrobat Reader does not offer the full functionality (in this case - page extraction), so the data of Security tab may be different against Adobe Pro.

By the way, following code snippet can be used to extract PrintDocument permissions.

[C#]

Permissions test = (Permissions)document.Permissions;<o:p></o:p>

if ((test & Permissions.PrintDocument) == Permissions.PrintDocument)

{<o:p></o:p>

// Document has PrintDocument permission<o:p></o:p>

}

Hi i have written the below code but for test.pdf it returns true & for test2.pdf it is returning false even though both the documents have page extraction as not allowed. what could be the issue.
password for both the files is 123
test.pdf (52.1 KB)
test2.pdf (52.3 KB)

boolean ExtractPageAllowed = (pdfDocument.getPermissions() & (Permissions.ExtractContent)) == Permissions.ExtractContent;