Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Dec 12, 2023 6:26 am

Hi Team,

In Spire.Officefor.NETStandard with version 8.11.0 is not decrypt the encrypted PDF document , It is working fine in with version 8.9.3.

Code :
PdfDocument doc = new PdfDocument("doc");
if (doc.IsEncrypted)
{
doc.Decrypt();
}

PFA for sample document and Error

ramkumar.r
 
Posts: 3
Joined: Tue Dec 12, 2023 6:08 am

Tue Dec 12, 2023 7:55 am

Hi,

Thank you for your inquiry.
Due to decrypting document without permission password doesn’t comply with Adobe Acrobat specifications. This issue has been solved in subsequent versions. If you want to decrypt encrypted pdf documents through Spire.Offiicefor.NETStandard 8.11.0, You can refer to the following code.
I put the complete code below for your reference:
Code: Select all
// Declare a string variable to store the path of the encrypted PDF file
String encryptedPdf = @"../Encryption.pdf";

// Create a new PdfDocument object
PdfDocument doc = new PdfDocument();

// Load the encrypted PDF file from the specified path
doc.LoadFromFile(encryptedPdf, "your permission password");
         

// Decrypt the loaded PDF document
doc.Decrypt();

// Save the decrypted PDF document to the same path with a new filename
doc.SaveToFile(@"../Decryption1.pdf", FileFormat.PDF);

// Close the PdfDocument object
doc.Close();


Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Tue Dec 12, 2023 10:54 am

Hi,

As we are not suppose to get a password of the document in my case , But the same document was working fine with version 8.9.3

ramkumar.r
 
Posts: 3
Joined: Tue Dec 12, 2023 6:08 am

Wed Dec 13, 2023 6:49 am

Hi,

Thank you for your feedback.
I can understand your work situation, but decrypting documents require a permission password, which is a strict requirement.
If you need to solve the current problem, that means you will only be able to use Spire.Offiicefor.NETStandard8.9.3.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Mon Dec 18, 2023 5:49 am

Hi Team ,

It is is not a password restricted document , we can able to view the document without password.

ramkumar.r
 
Posts: 3
Joined: Tue Dec 12, 2023 6:08 am

Mon Dec 18, 2023 7:25 am

Hi,

Thank you for your feedback.
Please kindly note that the password of PDF documents is classified into Document open password and permission password, as shown in the screenshot below.
If your pdf document doesn’t have Document password, but it has permission password. When you decrypt this pdf document, you need to enter a permission password to decrypt the document.
test.png


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF