Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ./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 Jun 7 '12 at 20:40

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

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 '14 at 18:41

You must log in to answer this question.