本文介绍了highcharts在我的渲染html页面中显示,我想在rails中使用wkhtmltopdf将其转换为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些文本数据和图形的html页面。我正在使用wkhtmltopdf gem从html页面生成pdf。

I have an html page with some text data and graph. I am using wkhtmltopdf gem to generate pdf from html page. Using highcharts, i am generating graph.

我已经尝试了一些选项,如下所示:

I already tried with some options as below

 - plotOptions: { series: { enableMouseTracking: false, shadow: false, animation: false } }, in Hightcharts jquery coding..

请协助我解决这个问题。

Please assist me to resolve this issue.

推荐答案

我不熟悉w / wkhtmltopdf,但我确实使用wkhtmltoimage来创建包含来自高图的图表的页面图像。我注意到的一件事是我必须将--javascript-delay设置为几秒钟,以确保图表有足够的时间加载。似乎wkhtmltopdf确实支持这个选项()。你可以看到这是否有帮助?

I am not familiar w/wkhtmltopdf but I do use wkhtmltoimage to create images of pages that contain graphs from highcharts. One thing I noticed is that I had to set --javascript-delay to be several seconds long to make sure the chart had enough time to load. It seems as though wkhtmltopdf does support this option (wkhtmltopdf v0.10.0_rc2 docs). Can you see if that helps?

以下是我们如何将它称为w / javascript延迟3秒:

Here is how we call it w/a javascript delay of 3 seconds:

/bin/wkhtmltoimage --javascript-delay 3000 "http://example.com/chartPage" "/path/to/image.png"

这篇关于highcharts在我的渲染html页面中显示,我想在rails中使用wkhtmltopdf将其转换为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 05:01