问题
I have a long table which shows rows on several pages. When a page ends, the row is printed half on one page and half on the next page. How can I make sure that the rows is printed completely on the new page?
回答1:
CSS property: page-break-inside: avoid;
on HTML tr
element does it.
Tested with:wkhtmltopdf 0.12.3
provided for Linux (Ubuntu Trusty) 32-bit / 64-bit built on Ubuntu 14.04.2
as provided at:
http://wkhtmltopdf.org/downloads.html#stable
A quick and dirty test may look like:
<tr style="page-break-inside: avoid;">
<!-- A little border to see the result more easily -->
<td style="border: solid 1px blue;">
Large text possibly displayed on several pages ...
Large text possibly displayed on several pages ...
Large text possibly displayed on several pages ...
Large text possibly displayed on several pages ...
</td>
<td>col2</td>
<td>col3</td>
</tr>
Mozilla Developer Network page-break-inside description
来源:https://stackoverflow.com/questions/36129306/page-break-for-long-table