I installed wkhtml from here http://code.google.com/p/wkhtmltopdf/downloads/list (specically the wkhtmltox-0.11.0_rc1-installer.exe for Windows). I called ir from the command line and it worked perfect, but when I try to call it using the PHP exec or shell_exec function, it only works if the wkhtmltopdf.exe is located in the same directory my php is.
So, if I do this:
exec("wkhtmltopdf c:/wamp/www/test/pdf.html c:/wamp/www/test/pdf.pdf");
and the wkhtmltopdf file is in the c:/wamp/www/test directory it works perfect, but if I do this:
exec("C:/Program Files/wkhtmltopdf/wkhtmltopdf.exe c:/wamp/www/test/pdf.html c:/wamp/www/test/pdf.pdf");
it doesn't work at all.
Can you help me? I'd like to make it work even when it's in another directory.
Thanks.
You have to put the path in quotes beacause of the space.
exec('"C:/Program Files/wkhtmltopdf/wkhtmltopdf.exe" c:/wamp/www/test/pdf.html c:/wamp/www/test/pdf.pdf');
Alternatively you could just add the wkhtmltopdf directory to your PATH
variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With