I'm trying to render an HTML page to PDF using wicked_PDF. The page contains several charts that I create using D3.js. On the PDF, only the axes of the charts are visible. The body of the chart is blank. I tried to convert the SVG to both a Canvas and a PNG image (encoded using Base64). IN both cases, the images display as HTML, but only the axes are shown in the PDF. Any suggestions?
Is seems that javascript does not work before rendering PDF.
First, be sure that it is enabled on rendering PDF. According to link, there exists option :disable_javascript => false
to render :pdf
.
Next, all assets must be included with absolute urls. According to the same link,
You must define absolute paths to CSS files, images, and javascripts; the best option is to use the wicked_pdf_stylesheet_link_tag, wicked_pdf_image_tag, and wicked_pdf_javascript_include_tag helpers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With