wkhtmltopdf / wkhtmltopdf

Convert HTML to PDF using Webkit (QtWebKit)
https://wkhtmltopdf.org
GNU Lesser General Public License v3.0
13.97k stars 1.82k forks source link

text cut off at top despite attempting various fixes. #2868

Open mustmodify opened 8 years ago

mustmodify commented 8 years ago

Using wkhtmltopdf 0.12.3 with an image in the header, the top line of the body text is often cut off.

image

I have tried various fixes I found around the interwebz with no luck. Please let me know if this is possible.

jw@logopolis:/projects/test-wk $ ~/downloads/wkhtmltox/bin/wkhtmltopdf -V
wkhtmltopdf 0.12.3 (with patched qt)

jw@logopolis:/projects/test-wk $ ~/downloads/wkhtmltox/bin/wkhtmltopdf -T 25mm -B 30mm -L 10mm -R 10mm --header-html /projects/genesis/inventory/header.html --user-style-sheet style.css /projects/test-wk/sample.html test.pdf

same problem, though different margins, with this:

jw@logopolis:/projects/test-wk $ ~/downloads/wkhtmltox/bin/wkhtmltopdf --header-html /projects/genesis/inventory/header.html --user-style-sheet style.css /projects/test-wk/sample.html test.pdf

Input files can be found here: https://gist.github.com/mustmodify/ecf02a7dbfbe8ee74155d35f39d9ba48

test-with-margins-specified.pdf

test-with-unspecified-margins.pdf

mustmodify commented 8 years ago

Just playing around, I discovered that if I do this:

<img ... style="float: left;" />

the problem goes away. Still, it would be nice to know if there were a non-total-hack way to do this. Also, if set the width to 100%, it breaks again... so... not a great workaround.

mustmodify commented 8 years ago

Also fails when the content is a table.