Problem: When creating a PDF from a HTML template using PuppeteerSharp if you have a table with lots of data, it will create a new page if the next row doesn't fit in the current one even when there is plenty of space to start the second row, see attached image. I need the second row to start right after instead of breaking into a new page.
What I have tried so far: I tried removing the <thead>
tag and when I do that then it actually utilizes the whole space as I want but then it removes the feature where every page starts with a header which I need to keep due requirements I can't change.
Libraries used:
- PuppeteerSharp
- DOTLiquid
Question:
How can I keep the <thead>
tag and keep puppeteer from starting the table row in a new page if there is still pace available? Maybe I can create my own table headers for each page without using <thead>
?
My HTML is a .liquid template:
<html>
<body>
<table>
<thead>
<tr>
<th>Header 1</td>
<th>Header 2</td>
<th>Header 3</td>
<th>Header 4</td>
</tr>
</thead>
<tbody>
{%for item in MyData.Items%}
<tr>
<td style ="width: 120px">{{item.TesData}}</td>
<td style ="width: 120px">{{item.TesData2}}</td>
<td style ="width: 120px">{{item.TesData3}}</td>
<td style ="width: 220px">{{item.TesData4}}</td>//This column have lots of data
</tr>
{%endfor%}
</tbody>
</table>
</body>
</html>