I am using .net with the lastest build of spire.PDF from nuget.
I use this code to convert. However, sometimes the library just result in a blank page, or a page with the text "black" in the top left corner. I hope you guy can help me fix it soon.
In the code below, "html" is a sting var containing html source code.
- Code: Select all
var doc = new PdfDocument();
var htmlLayoutFormat = new PdfHtmlLayoutFormat {IsWaiting = true};
var setting = new PdfPageSettings {Size = PdfPageSize.A4};
var thread = new Thread(() =>
{
doc.LoadFromHTML(html, false, setting, htmlLayoutFormat);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();