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.
Wed Nov 06, 2019 1:26 am
Hello
I found that the following code takes 45 seconds, it seems the speed issue is around thread.join()
Is there any way to improve the speed?
- Code: Select all
private string SaveToTemp(string data, string type)
{
Thread thread;
// Url to Pdf
thread = new Thread(() => { doc.LoadFromHTML(data, true, true, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
doc.SaveToFile(fullPath);
doc.Close();
return fullPath;
}
-

[email protected]
-
- Posts: 4
- Joined: Mon Jun 18, 2018 12:50 am
Wed Nov 06, 2019 7:09 am
Hi,
Thanks for your inquiry.
Please try to set waiting time.
- Code: Select all
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
htmlLayoutFormat.LoadHtmlTimeout = 2000;
Besides, there is a new method with plugin to convert HTML to PDF, you could have a try:
https://www.e-iceblue.com/Tutorials/Spi ... lugin.htmlIf there is still the issue, please provide your HTML for further investigation.
Sincerely,
Betsy
E-iceblue support team.
-


Betsy.jiang
-
- Posts: 3099
- Joined: Tue Sep 06, 2016 8:30 am