PHP data to chart to image to pdf [closed]

2020-06-06 07:34发布

问题:

I would like to generate a chart from a dataset and eventually put it in a pdf format. How would I go about doing this? Which packages would you recommend?

回答1:

A solution might to go in two steps :

  • first, generate the chart, and save it as an image
  • then, embed this image in a PDF file

About the first point, there are many questions/answers that might help you ; for instance :

  • Graphs/Charts in PHP
  • What is the best open source PHP charting solution
  • Free Chart Libraries for PHP
  • References on creating Charts/Graphs in PHP ?

About the second point, I've not done that quite often, but I suppose Zend_Pdf, for instance, could be helpful -- note there are probably other solutions too !



回答2:

I would look into these:

  • gChartPHP
  • pChart
  • Open Flash Chart

  • Dynamically Generate PDF file with PHP



回答3:

Take a look at the Diagrams AddOn for fpdf.
I've never used it but would give it a try before storing a raster image of a chart in a pdf.



回答4:

You can insert charts in PDF as an image too.
Google's Image Charts is deprecated but still works.
A ditto copy of Google's Image Charts is Image Charts which has free version with their watermark.