简体   繁体   English

使用PHP mPdf生成的pdf中的Highchart渲染

[英]Highchart render in pdf generated using PHP mPdf

Can anybody suggest me what should I do ? 任何人都可以建议我该怎么办? I am generating the PDF report and in the report, I have to print the high chart graph. 我正在生成PDF报告,在报告中,我必须打印高图表图表。 As high chart uses the javascript which will not execute in PDF file, So I have to create the graph on the server. 由于高图使用不会在PDF文件中执行的javascript,因此我必须在服务器上创建图形。

I read many posts, they suggest me that i have to create the image of that graph, but my question is how will I create the image to that graph ? 我阅读了很多帖子,他们建议我必须创建该图形的图像,但我的问题是如何创建该图形的图像?

You could try using server-side "browser" or JS engine to generate your graphs; 您可以尝试使用服务器端“浏览器”或JS引擎来生成图形; there are tools that can be used for that. 有一些工具可以用于此。

For that purpose I used those: 为此,我使用了那些:

  • PhantomJS : some quirks regarding header/footers but a nice lot of examples on website PhantomJS :关于页眉/页脚的一些怪癖但在网站上有很多例子
  • WkHTMLToPDF : highly customisable, but I had trouble setting timeouts properly so graphs are fully generated before PDF output WkHTMLToPDF :高度可定制,但我无法正确设置超时,因此在PDF输出之前完全生成图形

But there are others. 但还有其他人。

正如Preuk所说,phantomjs是一个不错的选择和我使用的,这里是Highcharts网站上的指南: http ://www.highcharts.com/news/56-improved-image-export-with-phantomjs它可以是一旦你开始运行它就会很好地开始运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM