Free Support Forum - aspose.com

HTML to PDF conversion - Ignore page-break-inside:avoid style

We have an issue when using Aspose.Pdf for HTML to PDF conversion:
In case an element is too big for the current page of a document we want it to skip to the beginning of the next page.
Therefore we added the style: page-break-inside:avoid;

For example,

Avoid page breaks

This works fine when printing the PDF document from the browser.
But when using Aspose.Pdf HTML to PDF conversion it does not work – the element is not displayed on the next page also if it does not have enough space on the current page.

@1589448058390

Please try to using following CSS property in order to add page break:

page-break-before: always;

In case you still face any issue, please share your sample HTML with us. We will test the scenario in our environment and address it accordingly.

Thanks,

The answer is not suitable in case both elements can fit in one page. In such cases no need to skip to the next page.

For example:

<div style=“width: 50%;”>
    Some short content…
</div>
<div style=“width: 50%;page-break-before: always;”>
    Some short content…
</div>

@1589448058390

Would you please share your complete HTML file in a .zip format. We will test the scenario in our environment and address it accordingly.