How to avoid an extra blank page

6,491 views
Skip to first unread message

Jānis Elmeris

unread,
Oct 31, 2012, 1:45:34 PM10/31/12
to wkhtmltop...@googlegroups.com
Hello!

I'm trying to get a PDF with this command: "/usr/bin/wkhtmltopdf --encoding utf-8 --margin-top 20.0 --margin-bottom 20.0 --orientation Portrait --page-size A4 body.html out.pdf". I'm attaching "body.html" to the e-mail, it's very short.

What I get is a bit of text (floating) on the first page and then a blank second page.
If I remove the margin style definition for "p" tag, the blank page vanishes. But I need that definition there. So, I tried to re-set margin of the sole "p" element to 'auto', explicitly set the height of it to '0', but still the blank page appears.

Can somebody understand what is going on, please? If I print this from Chrome, it displays ready-to-print one page, if I print this from Chrome but set to save it as PDF, there too I get two pages.

I'm using wkhtmltopdf 0.9.6.

Thanks!
body.html

Filippo Dossena

unread,
Nov 26, 2013, 12:49:35 PM11/26/13
to wkhtmltop...@googlegroups.com
Hi Jānis,
did you manage to resolve the problem?
I'm stuck with the same problem...

Many thanks!

Filippo Dossena

unread,
Nov 26, 2013, 1:15:18 PM11/26/13
to wkhtmltop...@googlegroups.com
It seems I found the solution.
The problem was with the CSS rule display: inline-block.
Setting it as display: block, it resolved the problem.


Il giorno mercoledì 31 ottobre 2012 18:45:34 UTC+1, Jānis Elmeris ha scritto:
Reply all
Reply to author
Forward
0 new messages