1

How to avoid page break inside <tr>?

(ANGULAR PROJECT) I have table (PrimeNG table) and I want to avoid break after print page. I use Chromium/Chrome browse. After print I have this result: enter image description here

So, how to avoid this, or how to disable repeat thead?

I tried this links, but dosen't work:

How to avoid page break inside table row for wkhtmltopdf

"page-break-inside: avoid "- does not work

avoid page break inside row of table

Iggsy
  • 103
  • 2
  • 12

2 Answers2

2

I have same problem. This combination helped me

@media print {
    html, body {
        width: 210mm;
        height: auto;
    }

    body {
        margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */
    }

    p, img, a, div.image, div{
        page-break-inside: avoid;
    }

    table, thead, tbody, tr, td, th, label, strong{
        page-break-inside: auto;
    }
}
Jogi
  • 98
  • 2
  • 8
0

The following is what worked in Chrome to:

  1. Prevent table cell contents from being split across a page break.
  2. Prevent table rows from having arbitrary vertical gaps between them a few rows after each page break.
@media print {
  tr, td {
    break-after: auto;
    break-inside: auto;
    line-height: 1;
  }
}
Patrick Berkeley
  • 2,156
  • 20
  • 26