Search code examples
unixwkhtmltopdf

wkhtmltopdf - How to use spaces in arguments?


I'm using wkhtmltopdf with local files. I've noticed that it doens't work with space in input/output filenames.

wkhtmltopdf --footer-left reports --footer-right [page]/[toPage] -O landscape report.html report.pdf

Here is a sample which gets "report.html" file, and converts to a PDF called "report.pdf", enabling a footer with a label written "reports" with the number of current and total pages. Works fine.


But now I need to set a string with spaces in the footer label. I've tried different ways to do it, like using quotes, double-quotes, encoding the space, etc, but not seems to work.

Something like this:

wkhtmltopdf --footer-left "Shell - January Report" --footer-right [page]/[toPage] -O landscape /var/shell_report_15_01.html /var/reports/shell_report_15_01.pdf

The argument "Shell - January Report" isn't recognized, seems like the quotes are ignored and these spaces are used as argument separators.

Thanks in advance!


Solution

  • I had the same problem, but weirdly enough, if you double the spaces, it works.