Free Support Forum -

EncryptFile method disables Print option

We are using .Net for encrypting PDF file. After the encryption print option is not enabled when PDF is opened with UserPassword. When opened with ownerpassword, all options are enabled. How can we enable only print option when UserPassword is used for opening document? The following is my code.
Aspose.Pdf.Kit.PdfFileSecurity fileSecurity = new Aspose.Pdf.Kit.PdfFileSecurity(@“UnSecureinput.pdf”, @“EncOutput.pdf”);

Aspose.Pdf.Kit.DocumentPrivilege priv = Aspose.Pdf.Kit.DocumentPrivilege.Print;
priv.AllowFillIn = false;
priv.ChangeAllowLevel = 0;
priv.AllowModifyContents = false;

//Calling EncryptFile method to encrypt the PDF document
retVal = fileSecurity.EncryptFile(“UserPassword”, “ownerpassword”, priv, Aspose.Pdf.Kit.KeySize.x256, Aspose.Pdf.Kit.Algorithm.AES);

Your help is appreciated.

Hi Murali,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 6.2.0 and I am unable to notice any problem. I have used the same code snippet as you have shared in your earlier post. I have used Adobe Reader 10.1.1 to view the document. For your reference, I have also attached the resultant PDF that I have generated. Please try using passwords as specified in your earlier post. Please try using Aspose.Pdf for .NET 6.2.0 and in case you still face any issue, please share the source PDF document that you are using. We apologize for your inconvenience.

When you upgrade to latest release version, please visit the following link for information on