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.

Thu Jun 06, 2019 10:02 am

Hi, there,
I tried to convert an html to pdf and I get a strange result.
The text is clipped because the library don't understand the "zoom" parameter in the inline css
more, it puts everything on one page even though I told him to use the A4 format.
Where am I wrong?

The attachment shows the html I used for the test, the pdf is too big and I can't attach it.

Thank you

Code: Select all
         var doc=new PdfDocument();
         var pgSt=new PdfPageSettings();
         pgSt.Size=PdfPageSize.A4;
         pgSt.Orientation=PdfPageOrientation.Portrait;

         var htmlLayoutFormat=new PdfHtmlLayoutFormat();
         htmlLayoutFormat.IsWaiting=false;
         htmlLayoutFormat.WaitingTime=2000;
         htmlLayoutFormat.Layout=Spire.Pdf.Graphics.PdfLayoutType.Paginate;

         var htmlpath=@"c:\tmp\x.html";
         var source=File.ReadAllText(htmlpath);
         doc.LoadFromHTML(source,false,pgSt,htmlLayoutFormat);

         doc.SaveToFile(@"c:\tmp\x.pdf");
         doc.Close();

mario999
 
Posts: 1
Joined: Thu Jun 06, 2019 8:43 am

Fri Jun 07, 2019 5:15 am

Hello,

Thanks for your inquiry.
I have noticed your issue with your html file and forwarded it to our development team. Sorry for the inconvenience caused. We will notify you once there is any update.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2767
Joined: Wed Jun 27, 2012 8:50 am

Tue Jul 23, 2019 7:05 am

Hi,

Thanks for your patient waiting.
Glad to inform you that we have a solution to convert your html file to Pdf well. Please follow this tutorial, https://www.e-iceblue.com/Tutorials/Spi ... lugin.html


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2767
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF