Search code examples
wkhtmltopdf

wkhtmltopdf error: specified in incorrect location


This is a part of my shell script, where ${1} is 'input.html' and ${2} is 'output.pdf':

wkhtmltopdf "${1}" "${2}" --page-size letter --dpi 150 --margin-top 0.2in --margin-bottom 0.2in --margin-left 0.2in --margin-right 0.2in

When I ran the above, I got the following error:

--page-size specified in incorrect location

My wkhtmltopdf version:

$ wkhtmltopdf --version

wkhtmltopdf 0.12.0 final

Solution

  • Changed it to:

    wkhtmltopdf --page-size letter --dpi 150 --margin-top 0.2in --margin-bottom 0.2in --margin-left 0.2in --margin-right 0.2in "${1}" "${2}"
    

    and it worked.