Tsohost Help Centre

Table of Contents

How to render HTML into PDF

Updated Oct 31st, 2017 at 12:06 GMT

On the $brand 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”);


 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