The page breaks in PDF can be controlled using the page-break-before:always, page-break-after:always and page-break-inside:avoid CSS properties.
When the page-break-before:always property is used in the style of a HTML element the converter will force a page break in PDF right before the place where the element is rendered.
When the page-break-after:always property is used in the style of a HTML element the converter will force a page break in PDF right after the place where the element is rendered.
When the page-break-inside:avoid property is used in the style of a HTML element the converter will try to avoid breaking that element between pages when that element is rendered in PDF document. It is not possible to avoid breaking the element in PDF if the element height in PDF is larger than one page.
In the HTML example below, the page-break-inside:avod property is set on each table row to avoid page breaks inside the table rows:
PDF Page Breaks Control Example
<html> <head> <title>Page Breaks in PDF</title> </head> <body> <table> <tr style="page-break-inside : avoid"> <td> <img width="100" height="100" src="image.jpg"> </td> <td> Table Row 1 </td> </tr> ....................................................... <tr style="page-break-inside : avoid"> <td> <img width="100" height="100" src="image.jpg"> </td> <td> Table Row 100 </td> </tr> </table> </body> </html> | |