I am trying to generate a PDF from HTML using PHP. I am running Mac OS X as my development environment although I would like this code to run on a production linux server.
So far I have got:
$url = escapeshellarg("http://www.google.com/");
$output = shell_exec("/usr/local/Cellar/wkhtmltopdf/0.11.0_rc1/bin/wkhtmltopdf " . $url . " /tmp/tmp_pdf.pdf 2>&1");
echo "<pre>$output</pre>";
This code does generate the PDF in the /tmp/tmp_pdf.pdf. The problem is it never does
echo "<pre>$output</pre>";
The browser just hangs saying waiting for server....
Its almost as if the shell_exec command never finishes. I notice when I run wkhtmltopdf from terminal it doesnt exit back to the command line. I get:
Loading page (1/2)
Printing pages (2/2)
Done
Then it sits there also, similar to the php script. Any ideas?