Open marioperna opened 1 year ago
I got a great result by placing a margin-bottom of 2000px, as the margin does not pass to the next page, it worked for me.
I noticed that the margin was going to the pages towards the end of the file. To resolve this, I calculated the number of pixels each page occupies. Based on the number of elements on my table.
This is my code
let html = generatehtml()
const MAX_ITEMS_ON_PAGE = 18
const inicialMarginHeight = items.length <= MAX_ITEMS_ON_PAGE ? 430 : 800
let tableHeaderHeight = items.length > 0 ? 60 : 0
let itemsHeight = (items.length % MAX_ITEMS_ON_PAGE + 1) * 20
let tableMargin = inicialMarginHeight - tableHeaderHeight - itemsHeight
html += `<div style='margin-bottom:${tableMargin}px; background-color: red'/>`
The red background helped me to know the right fit
Hello,
I am generating a pdf starting from an HTML template containing a table.
Currently, my issue is about how to interrupt the table row before the end of the page or In general how to interrupt the page and go to the next.
I've already tried to use some CSS selectors such as
page-break-before
,page-break-after
Etc... but none of them seem to work well. Is there any special syntax for this package to force the breaking?I know this package is deprecated, but I hope you can help me out. Thanks a lot