Tsohost Knowledge Base

How to render HTML into PDF

Modified Wednesday 1st July, 2015 at 12:32

Was this helpful?

On the Tsohost Cloud you can now use wkhtmltopdf and wkhtmltoimage command lines. These utilities turn a web page (including css and images) into a PDF or image respectively.

In your script run: 

<?php

shell_exec(“/usr/bin/wkhtmltopdf enter URL enterfilename.pdf”);

?>

 for example

<?php

shell_exec(“/usr/bin/wkhtmltopdf http://www.tsohost.com Tsohost.pdf”);

?>

If you are using a CMS where this utility is bundled, the above example won’t run due to grsec. To get this to work simply update the path to use /usr/bin/wkhtmltopdf

Still can't find what you're looking for?

Not a problem - our 24/7 customer support team are super friendly and here to help answer all your questions. There's no need to wait, click below to start a Live Chat.

Start Live Chat

Still can't find what you're looking for?

Not a problem - our 24/7 customer support team are super friendly and here to help answer all your questions. Don't delay, click below to find out how you can get in touch.

Get in Touch