-
-
Save aur1mas/733109 to your computer and use it in GitHub Desktop.
<?php | |
try { | |
$wkhtmltopdf = new Wkhtmltopdf(array('path' => APPLICATION_PATH . '/../public/uploads/')); | |
$wkhtmltopdf->setTitle("Title"); | |
$wkhtmltopdf->setHtml("Content"); | |
$wkhtmltopdf->output(Wkhtmltopdf::MODE_DOWNLOAD, "file.pdf"); | |
} catch (Exception $e) { | |
echo $e->getMessage(); | |
} |
clemherreman, yep :) mistype from copy & pasting the code.
Hello,
I'm currently trying to use Wkhtmltopdf but it's not working... not yet at least.
I do have a pdf file at the end but it is not readable.
My code to run the class:
'/var/www/test/')); //$wkhtmltopdf = new Wkhtmltopdf(array('path' => APPLICATION_PATH . '/../public/uploads/')); $wkhtmltopdf->setTitle("Title"); $wkhtmltopdf->setHtml("http://www.google.com"); $wkhtmltopdf->output(Wkhtmltopdf::MODE_DOWNLOAD, "myfile.pdf"); } catch (Exception $e) { echo $e->getMessage(); } ``` ?>Any idea of the problem?
Thanks in advance,
Romain
PS: I am working with Linux
My guess is that your wkhtomtopdf must have some problem.
Display the full exception, and not only the message, and also display the return of Wkhtmltopdf::_render, you'll have plenty of information to debug this =).
Hello,
Thank you for your reply.
I've added the line $wkhtmltopdf->Wkhtmltopdf::_render; at the end.
I've got this error: "The website encountered an error while retrieving http://localhost/test/. It may be down for maintenance or configured incorrectly".
So it's not working anymore.
How can I display the full exception?
Many thanks,
Romain
Maybe you meant
new Wkhtmltopdf
instead ofnew Core_Wkhtmltopdf
?