1
votes

I am trying to get wkhtmltopdf to work with PHP. I compiled wkhtmltopdf 0.12.2-dev (with patched qt) on debian 6.

it works when I am on the server (shell):

./wkhtmltopdf ./tmp.html output.pdf
Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

it also works when the command is in a php file (exec ("./wkhtmltopdf ....")) and I call the php file in the shell:

php makepdf.php

But it does not work when I call the php file in my browser. return code from the exec is 127 That means that the wkhtmltopdf could not be found? I tried also to use absolute paths. verything is chmod +x

Any idea how to get wkhtmltopdf to work with php?

1
What's the output of stat wkhtmltopdf? - Jeremiah Winsley

1 Answers

1
votes

Thats correct.

You call the wkhtml programm ober ./ use the complete path to the progam then its working.

/usr/local/bin/wkhtmltopdf /tmp/tmp.html output.pdf

for example.

http://mikehaertl.github.io/phpwkhtmltopdf/

Here is a wrapper. Perhaps you can use it and configure it.