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.

Fri Dec 18, 2020 12:18 pm

I have a source html that contains many following tags:
<P style=""PAGE-BREAK-BEFORE: always""></P>

(that is, add page break(s) when printing the html)

My issue is, when converting the html content to PDF,
how can let the generated PDF file produce new pages, accordingly?

grchen168
 
Posts: 32
Joined: Sat Jan 24, 2015 4:48 pm

Mon Dec 21, 2020 6:01 am

Hello.

Thanks for your inquiry and sorry for the late reply as weekend.

Please refer to this article and the following code to let the generated PDF file produce new pages accordingly when printing the HTML with page-break. I also attached my test HTML.
Code: Select all
            Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert("E:\\testdoc\\test.html", "HTMLtoPDF.pdf",
                true,
                100 * 1000,
                new SizeF(PdfPageSize.A4),
                new PdfMargins(0, 0)) ;

If you have any other questions, please feel free to contact us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF