mileszs / wicked_pdf

PDF generator (from HTML) plugin for Ruby on Rails
http://www.mileszs.com/wicked-pdf-plugin
MIT License
3.54k stars 647 forks source link

Unable to render any charts/javascript in pdf #817

Open achaves06 opened 5 years ago

achaves06 commented 5 years ago

Issue description

When creating the pdf no charts or content created as part of javascripts is rendered. I have tried multiple versions of chart.js as well as Google Charts. Neither works. Displaying as html works perfectly. Also, trying to set responsive: false in the chart.js config results in a runtime error Could not load Page (1/6)

Expected or desired behavior

Charts should be shown just like they do in the html view.

System specifications

wicked_pdf gem version : wicked_pdf (1.2.1)

wkhtmltopdf version : wkhtmltopdf 0.12.4 (with patched qt)

whtmltopdf provider gem and version if one is used: whtmltopdf-binary gem

platform/distribution and version (e.g. Windows 10 / Ubuntu 16.04 / Heroku cedar): Ubuntu 18.04

quadur commented 5 years ago

I can confirm that, we have the same problem - simple vanilla JS works well but when we include our application.js in the header with <%= wicked_pdf_javascript_include_tag 'application', 'data-turbolinks-track' => true %> and try to use any jquery function it just stops parsing javascript (even that simple vanilla js line stops working).

In the debug mode all works well, our gem versions.

wicked_pdf 1.2.2 wkhtmltopdf-binary-edge 0.12.5.0 platform: ubuntu 18.04.2

Wmeng98 commented 4 years ago

I wonder if this issue is related to a dependency on the libssl1.0-dev package? Can you try installing that? apt-get install libssl1.0-dev Though it isn't recommended that you downgrade your libssl it does fix the issue of chart generation for older versions of wkhtmltopdf.

The issue with wkhtmltopdf and libssl compatibility should be fixed on v0.12.5 as well.