danfickle / danfickle/openhtmltopdf
Bug on repeating table header when using page-break-after: avoid; inside table
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I found an issue when using page-break-after: avoid; in a table:
I have a use case where I need to keep together two elements.
I created two reproducers to illustrate better the issue:
Source:
[category_children_on_different_page.txt](https://github.com/danfickle/openhtmltopdf/files/4320381/category_children_on_different_page.txt)
Produces:
[category_children_on_different_page.pdf](https://github.com/danfickle/openhtmltopdf/files/4320384/category_children_on_different_page.pdf)

The problem here is the text "CATEGORY" is on page1, but his children started on page2. I would like to keep then together. So, I put this code: (just added page-break-after: avoid; on tbody)
```
CATEGORY
```
Indeed, CATEGORY now is together with its children, BUT the repeating header is gone:
Source:
[category_together_with_children_but_bug_on_repeating_header.txt](https://github.com/danfickle/openhtmltopdf/files/4320401/category_together_with_children_but_bug_on_repeating_header.txt)
Produces:
[category_together_with_children_but_bug_on_repeating_header.pdf](https://github.com/danfickle/openhtmltopdf/files/4320403/category_together_with_children_but_bug_on_repeating_header.pdf)

All the contents are dynamic, so I don't know in advance how big will be itens or subitens. So far the only way I could achieve the desired output was using "page-break-after: avoid;".
I tried using widows / orphans, but I guess it does not work on tables.
Thanks for this great library. Hope you can continue this great work.
Best wishes,
lagar84.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.