ARTICLE AD BOX
I am converting HTML to PDF using wkhtmltopdf 0.12.6.1 (patched Qt).
The HTML renders correctly in all browsers, but the generated PDF has a layout issue with tables that span multiple pages.
Problem description
When a table:
spans multiple pages
uses <thead> so headers repeat
has many columns (15+ in the real use case)
contains very long text in one or more table cells (<td>)
a single table row (<tr>) can span across two pages.
When this happens, wkhtmltopdf repeats the table header on the new page but does not reserve vertical space for it, causing the repeated header to overlap the continuation of that same row. In some cases, the row content is partially truncated.
This issue only occurs when one row itself breaks across pages.
Rows that fit entirely on a single page render correctly, even in multi-page tables.
wkhtmltopdf command used
wkhtmltopdf \ --orientation Landscape \ --footer-center "name of the template" \ --footer-font-size 10 \ --footer-spacing 5 \ input.html output.pdfMinimal reproducible example
The following HTML renders correctly in browsers but produces header overlap in wkhtmltopdf when a row’s cell content flows onto the next page:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> body { font-family: Arial; font-size: 10pt; line-height: 1.4; } table { width: 100%; border-collapse: collapse; } table, th, td { border: 1px solid black; } td { padding: 10px; white-space: normal; word-wrap: break-word; } </style> </head> <body> <table> <thead> <tr> <th>ID</th> <th>Description</th> <th>Date</th> </tr> </thead> <tbody> <!-- duplicate this row to force a page break --> <tr> <td>1</td> <td> <!-- Add a very long text to force a page break --> This is a very long text value that wraps into multiple lines and causes the content of this cell to continue onto the next page. When this happens, the repeated table header overlaps the continuation of this same row in wkhtmltopdf. </td> <td>23/01/2026</td> </tr> </tbody> </table> </body> </html>Question
Is there a way to make wkhtmltopdf correctly repeat table headers when a single table row spans multiple pages, without header overlap or row truncation?
Are there known CSS workarounds, or is this a known limitation of wkhtmltopdf’s layout engine?
