Created
December 8, 2010 10:14
-
-
Save aur1mas/733109 to your computer and use it in GitHub Desktop.
usage example https://github.com/aur1mas/Wkhtmltopdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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