使用 PHP 和 Highcharts 每周生成 PDF
我的项目使用 Highcharts 生成各种图表,这些图表随后在仪表板上使用,并作为向经理提供各种绩效报告的基础。不久前,经理们决定每周生成一份 PDF 文档的大报告(可能有 50 页或更多页),并且必须包含他们现在已经习惯的几个图表。
我想知道是否可以使用 PHP 自动生成这样的报告(一些图像、文本、表格和图表),例如作为每周日午夜启动的 cron 任务。我从未使用 PHP 创建过 PDF,因此如果有人能建议我从哪里开始,我将不胜感激。
- 使用 PHP 生成 PDF 的最佳类是什么,包括插入图像、文本、表格等的功能?
- 如何在我生成的 PDF 中插入 Highcharts 图表?
- 我应该如何生成大型 PDF 文档(50+ 页)?
谢谢您的宝贵时间!
My project uses Highcharts to generate all sorts of charts that are later used on dashboards and as the basis for various performance reports to the managers. A while ago the managers decided they want a big (probably, 50 or more pages) report generated weekly as a PDF document, and it has to include several charts that they are so used to by now.
I was wondering if it is possible to generate such a report (some images, text, tables, plus charts) automatically using PHP, for example, as a cron task that would start every Sunday midnight. I have never created PDFs using PHP, so I would be really grateful if someone could advise me on where to start.
- What are the best classes for PDF generation using PHP that would include ability to insert images, text, tables, etc.?
- How can I insert a Highcharts graph in the PDF that I am generating?
- How should I approach generating a large PDF document (50+ pages)?
Thank you for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有关 highcharts 的事情,但在他们的网站上我看到过,您可以将图表导出到图像,这是您可以用来将它们包含到 PDF 中的一种方法。
要创建 PDF,您可以查看 pdfLIB,这可以生成您的 PDF HTML 站点之外。因此,您只需生成当前页面的新视图并通过库将其呈现为 PDF。
他们还获得了 PHPH 的操作指南: http:// www.pdflib.com/en/developer/technical-documentation/pdflib-in-php-howto/
我希望这将帮助您生成 PDF。
I don't know somethign about the highcharts, but on their website I've seen, you can export the charts to an image, this is a way you could use to include them into your PDFs.
To create the PDFs you could checkout pdfLIB, this can generate your PDFs out of the HTML site. So you only habe to generate a new View of your current page and render it as PDF via the library.
They also got a howto for PHPH: http://www.pdflib.com/en/developer/technical-documentation/pdflib-in-php-howto/
I hope this will help you generating your PDFs.