I am trying to use wkhtmltopdf to create a pdf out of a webpage I made which has a specific width and hieght. I get a few blank pages, none of which are my xhtml.
wkhtmltopdf.exe --margin-bottom 0px --margin-left 0px --margin-right 0px --margin-top 0px --page-width 200px --page-height 500px C:\Users\user\page.xhtml C:\Users\user\finally.pdf
What am I doing wrong? The documentation did not help me find my error.
It appears that you cannot specify a page dimension as pixel units. This is ok for margins, but not for page. Indeed, a pdf file was designed at the beginning to be printed, so it needs to have physical dimensions. Pixel values mean nothing physically, unless you give along a dpi (or ppi) value.
So the correct command line would be something like:
wkhtmltopdf.exe --margin-bottom 0px --margin-left 0px --margin-right 0px --margin-top 0px --page-width 4cm --page-height 20cm input.html output.pdf
Just adjust the values to your needs, according to the dpi resolution you need.
This is not explicitly stated in the manual, but I confirm that you get an empty page with page dimensions expressed in pixels.