<< back ### PD4ML: Conditional PDF page breaks. Widows and Orphans PD4ML introduces a proprietary page break tag: <pd4ml:page.break> (and its synonym <pd4ml-page-break> for strict contexts). Without parameters it just forces a pagebreak. But its ifSpaceBelowLessThan attribute allows us to keep some content portions on the same page. Let's say we have an image and a caption, belongs to it:
    Chart #4.2<br>
    <img src="images/chart42.png" width="400" height="300">
If we want to be 100% sure the caption and the image are on the same page, we could put a page break tag before the caption definition. But that can result an inefficient previous page space usage or can even result a blank page. If we place a conditional page break tag:
    <pd4ml:page.break ifSpaceBelowLessThan="330">
    Chart #4.2<br>
    <img src="images/chart42.png" width="400" height="300">
it will break only if the remaining space on the current page is less than 330px (and the image 300px high and the caption - let's say 30px - do not fit the space). Another option to achieve similar functionality is to use CSS page break control:
    <table style="page-break-inside: avoid">
    <tr><td>
    Chart #4.2<br>
    <img src="images/chart42.png" width="400" height="300">
    </td></tr>
    </table>