danfickle / danfickle/openhtmltopdf
How can I get table pagination functionality while making sure some variable length content appear on one page?
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
Edit:
I was able to get it to work by putting the things I want to stay on a page in a tbody with `page-break-inside: avoid`, but the header is orphaned on the previous page.
It does not seem to be fixed by https://github.com/danfickle/openhtmltopdf/pull/418
---
Original:
I have a header, variable length text and multiple rows of images. I want the header, the text and one row of images to appear on the same page. If they can't fit in the space on the current page, I want to page break before.
I also need the header to paginate. So if the subsequent images are on other pages I want the header to appear on those pages as well.
I can get the page break affect I want using divs and `page-break-inside: avoid`, and I can get the pagination working with `table style="-fs-table-paginate: paginate;`, but I can't get them both to work. `-fs-page-break-min-height` doesn't work because I don't know how many pixels the text can be.
Is there a way to accomplish this?
Example:
```
.samepage {
page-break-inside: avoid;
}
div.box {
width: 300px;
height: 300px;
margin: 8px;
background-color: #747678;
display: inline-block;
}
Example PDF
Foo
Variable length
text
More Boxes
Variable length
text
Paginated Title
Variable length
text
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.