I created an XSL-FO template which prints a few blocks containing texts that change dynamically. Sometimes a block is split across two pages because there is not enough space on the page. Is there a way to put the block on the next page instead of splitting it across pages if it does not fit? I tried to put it into a table with keep-together="always" but then each text is on single line (no line wrapping) and overflows the right page margin where it disappears. Thank you in advance!
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row keep-together="always">
<fo:table-cell
border-width="1px"
border-color="black"
border-style="solid"
background-color="#ffffff"
text-align="left">
<fo:block>
Text 1
</fo:block>
<fo:block>
Text 2
</fo:block>
<fo:block>
Text 3
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
Most likely, you could use the page-break-inside
attribute:
<fo:block page-break-inside="avoid">
...
</fo:block>
There also exist other page-break
attributes. Take the best one:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With