Using wkhtmltopdf with highcharts shows blank chart

强颜欢笑 提交于 2019-12-06 13:24:50

I had this issue and the cause was JavaScript errors. You can confirm this by running wkhtmltopdf with the --debug-javascript flag. For more detailed debugging (e.g. line numbers) you'll have to download the QtWeb browser.

Specifically in my case the two issues were that Object.values(obj) is an undefined function and $('a:not(.ignore)') is a syntax error (when jQuery 3.1.1 tried to use the selector). The fix was to use Object.keys(obj).map(function (key) { return obj[key] }) and $('a').not('.ignore').

To me it seemed to me that the graph would stop rendering midway through. So what worked for me was setting the animation off:

plotOptions: {
    series: {
        animation: false
    }
}

This way the chart is ready once the pdf is generated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!