I am having a very complicated problem using "LoadFromHTML" of Spire.Doc.
On the development PC with Windows 10 no problem, the PDF is properly generated; while installing the .NET project on a Windows Server 2003 SP2 when the PDF be generated start a process DW20.exe that occupies the 90-100% CPU making the server effectively blocked.
Can you help me?
The Code:
- Code: Select all
String MyHTML = "<B>Hello World</B>";
PdfPageSettings pageSettings = new PdfPageSettings();
pageSettings.Margins = new Spire.Pdf.Graphics.PdfMargins(10, 10, 10, 10);
pageSettings.Orientation = PdfPageOrientation.Portrait;
pageSettings.Size = PdfPageSize.A4;
Spire.Pdf.HtmlConverter.PdfHtmlLayoutFormat htmlFormat = new Spire.Pdf.HtmlConverter.PdfHtmlLayoutFormat();
htmlFormat.FitToPage = Spire.Pdf.HtmlConverter.Clip.Both;
PdfDocument doc = new PdfDocument();
Thread thread = new Thread(() => { doc.LoadFromHTML(MyHTML, true, pageSettings, htmlFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
String FileNamePDF = "doc.pdf";
doc.SaveToFile(FileNamePDF);
doc.Close();
Thank you,
Alessandro