Free Support Forum -

HTML to PDF. page break

I am using Aspose HTML to PDF. I just want to put a page break in HTML after certain condition. I use css “page-break-before: always;” I can see page break in HTML but once PDF is created using ASPOSE, there is no page break in converted PDF.

The CSS page break before property “page-break-before: always;” is working fine in our environment on converting an HTML file to PDF format. Please refer to the following input and output documents: (19.2 KB). We have converted an attached HTML file with the following source code (using Aspose.Pdf for .NET API version 17.6):


 // Specify the The base path/url for the html file which serves as images database
String basePath = @"C:\Pdf\test127\";
HtmlLoadOptions htmloptions = new HtmlLoadOptions(basePath);
// Load HTML file
Document doc = new Document(basePath + "Input.html", htmloptions);
// Save HTML file
doc.Save(basePath + "output.pdf");

If this does not help, then kindly share your source HTML file. We will investigate and share our findings with you.

Best Regards,
Imran Rafique


Even being an old topic… is it possible to share the HTML sample for the page breaks? We are evaluating Aspose for renewing our Aspose Total license, but we’re currently having some issues with page breaks.

Thank you


Thanks for contacting support.

You may please download sample files from this link. In case you face any issue, please feel free to let us know.