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.

Thu Apr 29, 2021 12:19 pm

Hello,

- We try to Encrypt pdf file (attached - it looks ok, every browsers can open it) by this code
Code: Select all
using (var stream = new FileStream(@"C:\Work\Errors\Wrong ecrypted Pdf\source_can_be_opened.pdf", FileMode.Open))
            {
                var pdf = new PdfDocument(stream);
                pdf.Security.Encrypt(
                   "037789",
                   "037789",
                   PdfPermissionsFlags.Print | PdfPermissionsFlags.CopyContent,
                   PdfEncryptionKeySize.Key128Bit);

                pdf.SaveToFile(@"C:\Work\Errors\Wrong ecrypted Pdf\encrypted_can_not_be_opened.pdf", FileFormat.PDF);
            }


Result file is corrupted and can't be even opened. Edge want to set password and next show info "File corrupted". Adobe reader show error 118 (Unexpected token) without password prompt.
Wrong ecrypted Pdf.zip


Best regards
Dariusz Arendarski

d.arendarski
 
Posts: 10
Joined: Mon Dec 07, 2020 10:13 am

Fri Apr 30, 2021 1:45 am

Hello,

Thanks for your inquiry!

I tested the code and the file you provided with the latest Spire.PDF V 7.4.13, but did not reproduce your issue. The generated PDF could be open by both the Adobe and the Google Chrome. Here I also attached my generated PDF file for your reference.

generated file.zip

If you were not using the latest Spire.PDF, I recommend that you can have a try first. If the issue still exists, please provide us with the following information to help us further investigate your issue. Thanks in advance.

1. You target framework (E.g. .Net FrameWork 4.6.1)
2. Your system information (E.g. Win7, 64 bit)
3. Your region setting (E.g. China, Chinese)

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Apr 30, 2021 5:57 am

Hello,
Thanks for fast replay. I have the following configuration.
Code: Select all
<packages>
  <package id="Spire.PDF" version="7.4.13" targetFramework="net47" />
</packages>


.Net Framewotk 4.7 (but i test it on 4.8 and still not work :( )

Regional setings (Pl-pl) but when I try to use
Code: Select all
 Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

problem still exist.

System information:
OS Name Microsoft Windows 10 Enterprise
Version 10.0.19042 Build 19042
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name BWAW-647
System Manufacturer Dell Inc.
System Model Latitude E5470
System Type x64-based PC
System SKU 06DE
Processor Intel(R) Core(TM) i5-6440HQ CPU @ 2.60GHz, 2601 Mhz, 4 Core(s), 4 Logical Processor(s)
BIOS Version/Date Dell Inc. 1.20.4, 20/05/2019
SMBIOS Version 3.0
Embedded Controller Version 255.255
BIOS Mode Legacy
BaseBoard Manufacturer Dell Inc.
BaseBoard Product 0792TG
BaseBoard Version A09

I assume that attachment I have send last time (generated on my environment) not working in Your machine too ?
May be it depends for example on third part decoder, if spire.pdf use some dependences ?

Best regards
Dariusz Arendarski

d.arendarski
 
Posts: 10
Joined: Mon Dec 07, 2020 10:13 am

Fri Apr 30, 2021 10:41 am

Hello,

Thanks for your sharing.
I did an initial test in a similar environment and indeed reproduced your issue. I have logged it into our bug tracking system with the ticket SPIREPDF-4269 for further investigation.
We will keep you informed if there is any update. Apologize for the inconvenience caused.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Thu Jun 03, 2021 10:49 am

Hello,

Thanks for your patience!

Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:7.6.0 which fixes your issue SPIREPDF-4269.

Please download the fix version from the following links to test.
Website link:
https://www.e-iceblue.com/Download/down ... t-now.html
Nuget links:
https://www.nuget.org/packages/Spire.PDF/7.6.0
https://www.nuget.org/packages/Spire.PDF.NETCore/7.6.0
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.PDF