tsoHost Help Centre

Table of Contents

How to render HTML into PDF

Updated Apr 21st, 2020 at 11:26 BST

On the Cloud system 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”);


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


 for example


shell_exec(“/usr/bin/wkhtmltopdf http://www.domain.com domain.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 or /usr/local/bin/wkhtmltopdf