Skip to Content
Menu
This question has been flagged
2 Replies
25073 Views

webkit report pages that overflow to the next page cut a line of the report in half. The top half of the line appears on the first page and the bottom half of the line appears on the second page.

Avatar
Discard
Best Answer

This is a very known webkit bug called the "page-break bug"

What essentially happens is that when the page-break the wkhtmltopdf library does not take the actual element and separate it on one page or the other it just prints the content and split the pages causing the effect you want to avoid

The solution for this is to place the iterative content (order lines, invoice lines) whatever you loop over and extends the report over several pages into a <div style="page-break-inside: avoid">

The css property "page-break-inside: avoid" works on divs and tables <table style="page-break-inside: avoid"> for what I've tested which I think have the common property of being "block elements"

So if you use tables to generate the report place the content as such <tr><td><div class="nosplit">${line.property}></div></td></tr>

Also make sure that the content in the header and footer is not larger than the actual margin you add (You can easily debug this by setting borders to the body in the header/footer and see if they are cut off).If the margins are not completly visible then just add margin until they are fully exposed to avoid content overshooting the header and overlapping with the mako

Hope this helps and anyone feel free to complete this answer and give feedback

Good luck!

Avatar
Discard

Can you specify which version of wkhtmltopdf you use, and tell us if there are some news about the header repeating, Best Regards

It doesn't matter which version it is, they all have this bug.The solution is in the Answer I gave which should prevent the page-break from hapening

Best Answer

Hi

This bug have been fixed in the latest version of wkhtmltopdf library. You can get it from here:

http://wkhtmltopdf.org/downloads.html

The new version also repeats the table header in each page, which is pretty good in sales orders and invoices that go 2 or more pages in length.

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 16
11112
7
Mar 15
6685
2
Mar 15
8811
0
Mar 15
3457
1
Mar 15
3481