Search code examples
phpwkhtmltopdfhtml2pdf

Execute wkhtmltopdf from PHP


I have this working fine from Linux command line:

wkhtmltopdf entry.html output.pdf

But the following doesn't work from PHP code:

exec ('wkhtmltopdf entry.html output.pdf');

Interesting, I've googled and a lot of non-checked solutions and with no explanation why this is a problem. Thanks if you have the good ones.


Solution

  • wkhtmltopdf has bindings, one of them is for PHP. You could give those a shot.