HTML + Highcharts to PDF

I am trying to create a PDF from a Lucee HTML page that contains a Highcharts chart. The page can be printed on my local printer and the chart looks good. I can even print to PDF, using the PDF plugins installed in my browser, and the PDF looks good.

But when I use <cfdocument format="PDF">, the resulting PDF has a hole in it where the chart should be. Of course, Highcharts generates the chart in the client’s browser (which cfdocument knows nothing about). So it seems I need to generate it on the server so that cfdocument can find it. Am I the only one who wants to do such a thing? what can I do about it?

only solution is to use batik to render svg to png

vote for this issue

1 Like

Another option is to use cfexecute to run wkhtmltopdf ( Basically I use Lucee to create an html page, save it to a temp file, then call cfexcute to run wkhtmltopdf over this file.

1 Like

Make sure all URL-paths to HighCharts and jQuery are absolute and full. So it would have to be https://siteurl.domain/assets/js/highcharts.js and same for jQuery. Or the CDN equivalent. Or try WKHTMLTOPDF via the available CFC. Paths there must be absolute also, as WKHTMLTOPDF needs to render the page with internet accessible paths. Good luck.

1 Like