Highcharts does not work with wicked_pdf
Asked Answered
C

3

6

I'm trying to generate a PDF report using the Wicked_pdf gem and Highcharts. I've already tried to set animation, enableMouseTracking and shadow false. But when wkhtmltopdf tries to generated the PDF files I got an error.

I really don't not what to do, because when I do the same procedure for an HTML, Highcharts renders perfectly.

Commonweal answered 22/1, 2013 at 23:39 Comment(0)
A
5

I fixed it by setting this options:

plotOptions:
  line:
    animation: false
    enableMouseTracking: false
    shadow: false

Also, don't forget to include JQuery and inline your styles and scripts

Anhydrous answered 19/3, 2013 at 0:51 Comment(0)
E
4

Try setting this:

series: { 'enableMouseTracking: false, shadow: false, animation: false' : nil}

This solution worked for me. I have a pdf view and a html view and implemented solution has:

<more highchart options>
...
plotOptions: {
                  line: {
                    marker: {
                      enabled: false
                    },
                    dashStyle: 'ShortDash'
                  },
                  series: { #{request.format == 'pdf' ? 'enableMouseTracking: false, shadow: false, animation: false' : nil} }
                },
...
<more highchart options>
Essive answered 23/1, 2013 at 6:40 Comment(1)
I solved it using the previous version of wkhtmltopdf, the version 0.10.0_rc2-static-amd64. The last version that i was using has some problems when render javascript.Commonweal
H
0

Try debugging in the QtWeb browser.

Instructions on debugging javascript in Qt here

You may find that your javascript contains unsupported syntax or keywords, which results in the issue as described.

The Qt WebKit rendering engine that wkhtmltopdf was using doesn't support ES2015, so you might have a simple solution like me, which was to replace keywords like let and const.

Henbane answered 26/10, 2018 at 12:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.