Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using wkhtmltopdf 0.10.0 rc2 on Ubuntu (Linux 3.2.0-24-generic #38-Ubuntu x86_64 GNU/Linux). The problem I'm experiencing is that I can't create PDFs with margin-top or margin-bottom. I'm not getting any errors.

I'm using the following commands:

wkhtmltopdf -T 50 -B 50 http://google.com ./test.pdf
wkhtmltopdf --margin-top 50 --margin-bottom 50 page.html ./test.pdf

However, when I try the following, margin-left and margin-right works perfectly (but still no margin-top or margin-bottom)

wkhtmltopdf -L 50 -R 50 -T 50 -B 50 page.html ./test.pdf

It doesn't matter which URL or page I try to convert. How can I set a margin-top and margin-bottom?

share|improve this question

migrated from serverfault.com Jun 7 '12 at 20:40

This question came from our site for professional system and network administrators.

1 Answer 1

I believe you're missing units. Try:

wkhtmltopdf -L 50mm -R 50mm -T 50mm -B 50mm page.html ./test.pdf

mm, of course, is millimeters. You could also do 0.5in or 2cm, something like that.

share|improve this answer
    
"mm" & "cm" units work, but "in" units appear to be ignored. (I'm using 0.12.1-rc for Win64.) –  user326177 May 23 at 18:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.