danfickle / danfickle/openhtmltopdf
Avoid empty header/footer rows on new page in openhtmltopdf?
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
I am using openhtmltopdf to generate paginated tables rendering in a pdf document, Below template rendering extra header and footer in an additional page, which shouldn't be, as there are no more rows left.
```
@page {
size: 400px 350px;
}
table {
width: 100%;
font-size: 16px;
border-collapse: collapse;
/* The magical table pagination property. */
-fs-table-paginate: paginate;
/* Recommended to avoid leaving thead on a page by itself. */
-fs-page-break-min-height: 1.5cm;
}
tr,
thead,
tfoot {
page-break-inside: avoid;
}
td,
th {
padding: 6px;
border: 1px solid gray;
}
tfoot td {
background-color: aqua;
}
thead th {
background-color: coral;
}
This example shows how to use table pagination.
The table header and footer are automatically reproduced on each page.
Title 1
Title 2
Hello
World!
Hello
World!
Footer 1
Footer 2
```
Below is the output it is rendering

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.