I need to convert an HTML page that is quite long. Spire.PDF successfully converts the HTML file to a PDF, but the PDF is too long, and is a single page. It is possible to break the HTML page into multiple pages in the PDF? Below is a snip-it of the code I'm using:
string sourceFile = @"C:\Temp\LongHTML\XX1024885.HTM";
string newFile = @"C:\Temp\LongHTML\XXX-DONE-1024885.pdf";
string sourceString = File.ReadAllText(sourceFile);
PdfDocument doc = new PdfDocument();
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
PdfPageSettings setting = new PdfPageSettings();
setting.Size = PdfPageSize.Letter;
Thread thread = new Thread(() => { doc.LoadFromHTML(sourceString, false, setting, htmlLayoutFormat);});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
doc.SaveToFile(newFile, FileFormat.PDF);
doc.Close();
System.Diagnostics.Process.Start(newFile);
Thanks for any ideas or solutions you may have.
Nick Solomon