danfickle / danfickle/openhtmltopdf

Avoid empty header/footer rows on new page in openhtmltopdf?

Open
#799 0 comments 0 reactions 0 assignees View on GitHub
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

![image](https://user-images.githubusercontent.com/6649902/150730326-768b8916-74b0-43c1-bf96-17b75dd79e53.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.