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: 


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


 for example


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?

That's not a problem. Our 24/7 customer support team are friendly and waiting to help answer your questions. The easiest way to get in touch is to raise a support ticket; simply click the button below.

Open Support Ticket