Hello,
Thanks for your inquiry.
We received your email about this issue on March 23, 2022, and made the following reply in the email I sent you on March 23, 2022:
I didn’t reproduced the scenario while I used the latest version of Spire.PDF (
Spire.PDF Pack(Hot Fix) Version:8.3.9) and the code you provided to encrypt the Example.pdf. If you’re not using this version, please download it and have a test. However, if you have any issues after test, please provide the information below. In addition, I put my test code below and attached the test result document. Thanks for your assistance in advance.
1) The .Net Framework version of your project, such as .net4.0.
2) Your system environment ( (E.g. Windows 10,64-bit) and region setting(E.g. China, Chinese) ).
My test code:
- Code: Select all
PdfDocument doc = new PdfDocument();
string sFileAtt = "G:/Example.pdf";
doc.LoadFromFile(sFileAtt);
PdfEncryptionKeySize keySize = PdfEncryptionKeySize.Key256Bit;
string openPassword = "123456";
string permissionPassword = "123456789";
PdfPermissionsFlags flags = PdfPermissionsFlags.Print | PdfPermissionsFlags.FillFields;
doc.Security.Encrypt(openPassword, permissionPassword, flags, keySize);
doc.SaveToFile("G:/Example-result.pdf");
Sincerely,
Abel
E-iceblue support team
Login to view the files attached to this post.