Continuing from this thread: http://forum.webfaction.com/viewtopic.php?pid=19127Hi Aaronh, thanks for your answer, I followed your instructions and got a bit further, it seems that the paths are working all right, temporary HTML files are generated in the server, but the PDF are not created (not stored in the server or opened in the browser), I get his error when I run the script: Fatal error: Uncaught exception 'Exception' with message 'WKPDF shell error, return code 2.' in /home/fariazz/webapps/pruebas/pruebapdf.php:207 Stack trace: #0 /home/fariazz/webapps/pruebas/pruebapdf.php(273): WKPDF->render() #1 {main} thrown in /home/fariazz/webapps/pruebas/pruebapdf.php on line 207 asked 20 Oct '10, 07:00 fxsymfony |
Ok problem solved. Once having wkhtmltopdf working on the command line just use this library instead of the other php script: http://github.com/knplabs/snappy answered 25 Oct '10, 20:26 fxsymfony |
The original script contains this:
In other words, it's setting Later in the code, the
So, it's building a URL out of If you followed the advice in the forum, then your code contains something like this:
That means that I think you should try the following:
I think that if you do that, all of the action will happen inside of your web app directory, which (as far as I can tell) is what the script expects. answered 21 Oct '10, 11:52 seanf Hi Seanf, Thanks for your answer. I started with the original script and followed the steps: 1-used the original $GLOBALS['WKPDF_BASE_PATH'] Then I added the following after the class definition: $pdf=new WKPDF(); $pdf->set_html('http://www.google.com'); $pdf->render(); (after the render method one needs to call the output method, but the error occurs when calling the render method) I get the same error as before: Fatal error: Uncaught exception 'Exception' with message 'WKPDF shell error, return code 2.' in /home/fariazz/webapps/pruebas/pruebapdf.php:207 Stack trace: #0 /home/fariazz/webapps/pruebas/pruebapdf.php(272): WKPDF->render() #1 {main} thrown in /home/fariazz/webapps/pruebas/pruebapdf.php on line 207 The script works just fine from the command line.
(21 Oct '10, 22:48)
fxsymfony
|
I've looked through your code and it seems that this line:
is the line causing the problem. I've looked through the example on the Google code page and I don't see where $pdf->render(); is called.