Suspension bridge

Get WkHtmlToPdf to work in CakePHP 2

Doing a website, and using the code from here: https://github.com/Milanzor/cakephp-wkhtmltopdf

Problem was that I was getting blank PDFs back.  Turns out it does not do error handling very well.

After debugging the output command etc, and it bombing out with "host not found" type errors, I copied from the "Tips and URLs" section into AppHelper, and this resolved the issue.

https://www.dereuromark.de/2014/04/08/generating-pdfs-with-cakephp/

Basically, it just ensures that when printing out to PDF it uses absolute URLs instead of relative (which don't work from a text file)



Tags: cakephp

← Back home

Banner photo by Clay Banks on Unsplash