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 Apr 13, 2020 9:19 am

Using the following code to convert HTML text string into PDF file (only for print access) with password,
but it seems not working (no pdf file generated):

thread=new Thread(() => { pdfdoc.LoadFromHTML(htmltext,false,pagesetting,htmllayoutformat); pdfdoc.Security.Encrypt("password","password",Spire.Pdf.Security.PdfPermissionsFlags.Print,Spire.Pdf.Security.PdfEncryptionKeySize.Key128Bit); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();

Is there anything wrong with the code?

grchen168
 
Posts: 32
Joined: Sat Jan 24, 2015 4:48 pm

Mon Apr 13, 2020 10:22 am

Hello,

Thanks for your inquiry.
I did an initial test with the latest Spire.PDF Pack(Hot Fix) Version:6.4.4, but the PDF document can be generated normally. To help us investigate your issue more accurately, please provide your htmltext string. Thanks in advance for your assistance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Apr 14, 2020 4:10 am

It's working now.
Thanks.

grchen168
 
Posts: 32
Joined: Sat Jan 24, 2015 4:48 pm

Tue Apr 14, 2020 8:37 am

Hello,

Glad to hear that.
If you need further assistance, please feel free to contact us.
Wish your all the best!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF