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 Jan 28, 2019 4:00 pm

Hi,

I'm using the doc.LoadFromHTML to convert a html page to PDF. The html is a basic table with a stylesheet, pretty basic. It is ~200 pages and appears to complete successfully but when reviewing the converted PDF, it is cutoff after 32 of 200 pages. I have a licensed version of the product.

sample source below. Any suggestions would be helpful, thanks

PdfDocument doc = new PdfDocument();
PdfPageSettings setting = new PdfPageSettings();
setting.Size = PdfPageSize.A4;
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
htmlLayoutFormat.Layout = PdfLayoutType.Paginate;
htmlLayoutFormat.IsWaiting = false;
String url = "file://testtable.htm";
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, true,true, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
doc.SaveToFile(@"testtable.pdf");
doc.Close();

damadake
 
Posts: 20
Joined: Wed Jan 18, 2017 12:56 pm

Tue Jan 29, 2019 3:08 am

Hi,

Thanks for your inquiry.
Kindly note that the LoadFromHTML method is based on the IE kernel. If the version of your IE is 9 or above version, the converted pdf will be rendered in image way and the content/image might be cut off. There are two suggestions for you.
1. Use Spire.Doc to convert the HTML to PDF.
https://www.e-iceblue.com/Tutorials/Spi ... d-XPS.html
2. Use the new plugin with Spire.PDF to convert HTML to PDF, which will generate text properly.
https://www.e-iceblue.com/Tutorials/Spi ... lugin.html

If you still have the issue after trying the two methods above, please provide us with following information for further investigation.
1. Your HTML and the result PDF you got.
2. The OS and Region information, e.g. Win7 64bit, China/Chinese.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Wed Jan 30, 2019 1:04 pm

Hi and thank you for the reply. The plugin provided the necessary. It was slower than expected but yielded the expected result.

Thank you for your assistance!
-dew

damadake
 
Posts: 20
Joined: Wed Jan 18, 2017 12:56 pm

Thu Jan 31, 2019 2:01 am

Hi,

Thanks for your feedback.
If there is any question, please feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Return to Spire.PDF