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.

Mon Oct 07, 2019 9:46 am

Hello,

I'm using this code to disable Print options:
Code: Select all
using (MemoryStream memoryStreamWriter = new MemoryStream())
            {
                PdfDocument doc = new PdfDocument(memoryStreamReader);
                doc.Security.Encrypt("TEST", permissionsFlags);
                doc.SaveToStream(memoryStreamWriter, Spire.Pdf.FileFormat.PDF);
                return memoryStreamWriter.ToArray();
            }


Where permissionsFlags = None.

But, when I open the document show an error code (see image I've attached)
But, if I remove this line:
Code: Select all
                doc.Security.Encrypt("TEST", permissionsFlags);


The PDF is shown correctly.
What's my problem?

Regards,

nagdalion
 
Posts: 11
Joined: Tue Jul 16, 2019 6:08 am

Mon Oct 07, 2019 10:38 am

Hi,

Thanks for your inquiry.
I did an initial test with the latest Spire.PDF (Spire.PDF Pack(Hot Fix) Version:5.9.16), but didn't encounter your issue. If you were using an old version, I would suggest that you give the latest version a try. If the issue still happens, please provide your input PDF file as well as your generated PDF file to help us further look into it. In the meanwhile, the screenshot you provided indicated that you were opening your generated PDF in browser, could you please also tell us the browser name (E.g. Google Chrome) and your OS information (E.g. Windows 7, 64 bit)? You could send your files to us via email ([email protected]).

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Mon Oct 07, 2019 10:50 am

Hi Nina,

Thanks for your reply.

I'm using FreeSpire.Office (4.3.1).
I'm using Google Chrome (Versión 77.0.3865.90 (Build oficial) (64 bits)) and Windows 10 (64 bit).

It's correct. The error only get in browser, if I open the document in PDF application, the error disappears.

Regards,

nagdalion
 
Posts: 11
Joined: Tue Jul 16, 2019 6:08 am

Tue Oct 08, 2019 6:48 am

Hi,

Thanks for your feedback.
Any question, welcome to contact us.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Tue Oct 08, 2019 7:02 am

Hi,

But, the error only occurs when I use this line:
Code: Select all
 doc.Security.Encrypt("TEST", permissionsFlags);


I don't think the problem is for the browser because if i remove that line, everything works perfectly.

Regards,

nagdalion
 
Posts: 11
Joined: Tue Jul 16, 2019 6:08 am

Tue Oct 08, 2019 9:50 am

Hi,

Thanks for your reply.
I made an initial test both with the latest Spire.PDF Pack(Hot Fix) Version:5.9.16 and the Free Spire.Office Version:4.3.0, I opened the result file using Google Chrome but didn't reproduce your issue. There won't be the error code on my side.

To help us investigate your issue accurately, could you please offer us the following information?
1. Your input Pdf file.
2. The result Pdf file.
3. Your Region information, e.g. China/Chinese.

We promise to keep your files confidential, and you could remove the sensitive information as long as your issue could still be reproduced. You could upload them here or send us([email protected]) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Thu Oct 10, 2019 5:51 am

Hello Amber,

1 - I attach the input.
2 - I attach the result PDF.
3 - Es-ES

Regards,

nagdalion
 
Posts: 11
Joined: Tue Jul 16, 2019 6:08 am

Thu Oct 10, 2019 8:20 am

Hi,

Thanks for your reply.
Sorry that I didn't find the attached files here, it seems that you didn't upload them here successfully. Could you please upload them here again or send to us([email protected]) via email?

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Thu Oct 10, 2019 9:24 am

OK.

I have sent to you the files.

Could you confirm it, please?

nagdalion
 
Posts: 11
Joined: Tue Jul 16, 2019 6:08 am

Thu Oct 10, 2019 10:41 am

Hi,

Thanks for your information via email.
I tested your Pdf file and did notice the error code issue you mentioned.

After further investigation, we found this issue is related to the browser you use. When I opened your Pdf file(10_10_2019 Cheque (1).pdf) using Google Chrome, I found there will also be the error code in the original Pdf file. I have attached the screenshot of the error code in the original Pdf file when it is opened by Google Chrome in the email.

I also tried to remove the code you mentioned(doc.Security.Encrypt("TEST", PdfPermissionsFlags.None)), and there will be the error code in the result Pdf file while opening by Google Chrome as well. I also attached the result Pdf file in the email, please check it.

However, both of the original and the result Pdf file could be opened correctly by Firefox.
I'm afraid it is not the problem of our products. Hope you could understand.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.PDF