We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML to PDF with page break

Hi

We recently got the license from Aspose pdf and I have a problem in converting a multipage html string to a multipage pdf file.

I am not able to specify page break properly. I want page break to happen after a specific line of the string. Can you please let me know if there is a way to specify page breaks in html, so the aspose pdf does the conversion based on the specified page break.


Hi Rajesh,


Thanks for your inquriy. You are right Aspose.Pdf dose note provide some option to page break during HTML to PDF conversion. You need to apply page break option in source HTML. You can use page-break CSS tag in HTML for the purpose, hopefully it will help you to accomplish the task. However if the issue persist then please share your sample HTML along with expected PDF output here, so we will look into the issue and will guide you accordingly.

Best Regards,

Hi

Thanks for the response. I tried using the following tags:

1)

2)

But both of them did not work. I have attached the HTML as well as the sample pdf which is not rendered properly. Can you look at the same and let me know what exactly I should add when I need a page break.

Hi Rajesh,


Thanks for sharing your sample HTML. I have add a page break tag in your HTML and converted it to PDF using following code snippet. Please find attached the sample output and confirm whether it fulfills your requirements.

Aspose.Pdf.Document
doc = new Aspose.Pdf.Document(@"D:\Downloads\InvoicesRATemplate\InvoicesRATemplate

  • PageBreak.html", new HtmlLoadOptions());<o:p></o:p>

doc.Save(@"D:\Downloads\InvoicesRATemplate\InvoicesRATemplate - PageBreak.pdf");


Best Regards,