I have a problem with wkhtmltopdf. I have an <article>
element that spans across multiple pages. It's is not defined in the CSS, the width is fixed. Yet when the element breaks across pages, sometimes parts of the text are stuck on both the the previous and the next page.
Do you have any idea what might cause that?
And a second question. In the screenshot below you can also see a strange square character, right after the word "Empfindung", that appears at some (not all) of the line endings (yet it's not a line ending, it's supposed to be a regular space). I tried replacing it with a regular space again, yet it stays the same. The encoding of the source website (and the content) is utf-8.
Thank you very much in advance!
Page breaking is a known problem with wkhtmltopdf and there's not so much you can do about it, but add a special div that forces the page break.
Maybe also look at this: wkhtmltopdf automatic page breaks
With regards to the square character: usually this is a font issue. If you want to know the reality then it's wise to just run it through an online converter that uses wkhtmltopdf (like htm2pdf.co.uk) and/or post the actual HTML you're using.
update from the wkhtmltopdf issuelist (http://code.google.com/p/wkhtmltopdf/issues/detail?id=9):
create a style that forbids to create a page break inside a class
<style>
.nobreak {
page-break-inside: avoid;
}
</style>
and put all your table cells, paragraphs, ... that should not be torn apart into a
<div>:
...<tr><td><div class="nobreak">This cell spans several <br> lines but<br> needs to be on the same page</div></td><td><div class="nobreak"> the second cell<br>that is not broken ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With