ruby on rails - ChartKick charts do not show when rendering to PDF using Wicked_PDF -



ruby on rails - ChartKick charts do not show when rendering to PDF using Wicked_PDF -

i using rails 4, wicked_pdf , chartkick gem's google charts use:

<%= javascript_include_tag "//www.google.com/jsapi", "chartkik" %>

the html view comes charts , expected. when append .pdf url pdf document shows in browser chartkick charts not show. next error appears chart should be:

error loading chart: no adapter found

i have found next online in pdfkit documentation.

resources aren't included in pdf: images, css, or javascript not seem downloading correctly in pdf. due fact wkhtmltopdf not know find files. create sure using absolute paths (start forwards slash) resources. if using pdfkit generate pdfs raw html source create sure utilize finish paths (either file paths or urls including domain). in restrictive server environments root_url configuration may looking alter asset host.

i assuming wkhtmltopdf not finding link charts, not sure how prepare this. have suggestion?

i found link: render jquery in wicked_pdf

where unixmonkey helps fattryan solve highcharts.

can help how set wicked_pdf_javascript_include_tag wicket_pdf take charts chartkick using google charts?

you have specify protocol http or https when referencing cdn within pdf layout.

also chartkick served via assets pipeline, utilize wicked_pdf_javascript_include_tag instead.

replace line:

<%= javascript_include_tag "//www.google.com/jsapi", "chartkik" %>

with this:

<%= javascript_include_tag "https://www.google.com/jsapi" %> <%= wicked_pdf_javascript_include_tag "chartkick" %>

that's how in project of mine.

cheers.

ruby-on-rails pdf charts wicked-pdf chartkick

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -