wkhtmltopdf thead overlapps content on second page
Asked Answered
V

1

10

Here is how my PDF result looks like (see the overlapping header on the second page):

enter image description here


The code is a simple HTML table with lots of content inside one TD element.

<table>
  <thead>
    <tr>
      <th>BESCHREIBUNG</th>
      <th>PREIS</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Lots of TEST's</td>
      <td>1,40 EUR</td>
    <tr>
  </tbody>
</table>

I know there is already this issue (as well as some others):

wkhtmltopdf repeating thead headers overlapping content

And the solution in there works for me:

thead { display: table-header-group; }
tfoot { display: table-row-group; }
tr { page-break-inside: avoid; }

However it only works for tables with multiple rows (tr's).

In my case as you see above I have a TD with a description that can contain quite a lot of content, so one single row would span across more than one page.

Does one have a solution for this special case as well?

Virgate answered 24/5, 2018 at 8:37 Comment(1)
Can you define a td {max-height: 90vh;}?Helgeson
F
2

The solution you have would work if you split your description into many pieces as a string array. And print each piece in a tr.

Furrier answered 12/3, 2020 at 16:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.