Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wkhtmltopdf css sizes in cm/mm

Tags:

I use wkhtmltopdf to produce A4 sized PDFs. When I create a <div> tag and set its style to height: 297mm; width: 210mm (which is the defined size of A4), set wkhtmltopdf's margin settings to 0 (wkhtmltopdf -B 0 -T 0 -L 0 -R 0 ...) and give the <div> a red background, I can see a thin white line at the bottom of the page, i.e. the <div> is not filling the page completely. This is happening consistently with 0.11.0 rc1 (the latest version) on Debian and with 0.10.0 rc2 on Mac OS X.

Has anyone else seen this? Is this a known problem, or is there a workaround?

like image 874
Simon Avatar asked Aug 29 '12 14:08

Simon


1 Answers

I had a method that worked for me that used margins.

style="margin:0,auto"

If that doesn't work try:

style="margin:0,auto,0,auto"
like image 116
yosh Avatar answered Oct 26 '22 18:10

yosh