We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to tell if document is encrypted

How can I tell if a document is encrypted?  I need to know to be able to prompt my user for a password.

1 Reply

PH Praveenkumar H Syncfusion Team May 22, 2013 05:19 AM UTC

Hi Brent,

Thank you for using Syncfusion products,

We can add the security settings to the document as follow.

PdfDocument doc=new PdfDocument();
// Set encryption key. 
doc.Security.KeySize = PdfEncryptionKeySize.Key128Bit; 
doc.Security.Algorithm = PdfEncryptionAlgorithm.AES;
// Setting username and password to protect the document. 
doc.Security.OwnerPassword = "syncfusion"; 
doc.Security.UserPassword = "password"; 
// Allow print with full quality. 
doc.Security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.FullQualityPrint; 
doc.Save("sample.pdf");

Please visit the below link for more information about the Pdf security.


Please let us know if you have any concern,

With Regards,
Praveen



Loader.
Up arrow icon