wkhtmltopdf with full page background

wkhtmltopdf v 0.11.0 rc2

What ended up working:

wkhtmltopdf --margin-top 0 --margin-bottom 0 --margin-left 0 --margin-right 0 <url> <output>

shortens to

wkhtmltopdf -T 0 -B 0 -L 0 -R 0 <url> <output>

Using html from stdin (Note dash)

echo "<h1>Testing Some Html</h2>" | wkhtmltopdf -T 0 -B 0 -L 0 -R 0 - <output>

Using html from stdin to stdout

echo “Testing Some Html” | wkhtmltopdf -T 0 -B 0 -L 0 -R 0 – test.pdf

echo “Testing Some Html” | wkhtmltopdf -T 0 -B 0 -L 0 -R 0 – – > test.pdf

What did not work:

  • Using --dpi
  • Using --page-width and --page-height
  • Using --zoom

Leave a Comment