I've tried both a encrypted and unencrypted PDF, but this method always returns a null.
PdfFileInfo pdf = new PdfFileInfo(new FileStream(@"c:\Separator.pdf", FileMode.Open, FileAccess.Read));
DocumentPrivilege priv = pdf.GetDocumentPrivilege();
I need to be able to read a PDFs security settings to prevent users from submitting the document to a back-end process.
Dear TBroyles,
Unencrypted file has no document privilege, so you get null.
To get document privilege from encrypted file, you should use this method:
public PdfFileInfo(Stream inputStream, String password)
or
public PdfFileInfo(String inputFile, String password)
and call
DocumentPrivilege priv = pdf.GetDocumentPrivilege();
Best Regards.
That worked, thanks.
Is there a way to read the document privileges? The properties of the DocumentPrivilege object are write only?
I'm trying to list the document restricitons for a encrypted PDF. The problem this addesses is that sometimes we get PDFs from outside sources that have restrictions applied. And I need to warn the end user that there may be issue when trying import or manipulate a PDF.
We don’t provide getting detail information from DocumentPrilige object currently. We will try to provide it in a week.
Could please tell me your requirement? What interface/method in DocumentPrivilege do you want to add?
I need an interface that will allow me to read the PDF restrictions (privilages) of an existing file.
The DocumentPrivilege has set only version of the properties I need.
I just need to be able to read them.