Page break for a long table

I have a long table that shows rows on several pages. When the page ends, the line is printed half on one page and half on the next page. How can I make sure the lines are printed completely on a new page?

+5
source share
2 answers

CSS property: element page-break-inside: avoid; on HTML tr does this.

Tested:
wkhtmltopdf 0.12.3 for Linux (Ubuntu Trusty) 32-bit / 64-bit built on Ubuntu 14.04.2 , as indicated at: http://wkhtmltopdf.org/downloads.html#stable

A quick and dirty test might look like this:

 <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 Browser Description

+8
source

Not working for me. Tested with wkhtmltopdf 0.12.4 Linux 64 bit. Style applied with

 thead, tr, td, th { page-break-inside: avoid !important; } 

Lines continue to break in the middle and overlap the ted on the next page.

+1
source

Source: https://habr.com/ru/post/1245480/


All Articles