如何将 Google 仪表图转换为 PDF 格式

发布于 2024-09-12 10:08:32 字数 97 浏览 2 评论 0原文

我只是想知道如何将 Google 仪表图转换为 PDF 格式。

有什么方法可以获取仪表图表(如条形图和饼图)的网址,我已经发送和接收了 PDF 格式的相应仪表图表。

I just want to know how to convert Google Gauge Chart in PDF Format.

Is there any way to get a url for gauge chart like bar chart and pie chart, which I have sent and received respective gauge chart in PDF format.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜心小果奶 2024-09-19 10:08:32

是的,您可以尝试将 google 图表转换为画布,然后从中获取 png 图像数据,这将允许您将 png 图像数据发送到 FPDF 等库,您可以在其中将图像保存为 PDF。
Google 图表是使用 SVG 创建的...要将 SVG 转换为画布,您可以使用库 canvg。它的工作原理类似于 canvg(yourCanvas, yourSVG) 然后使用 var PNGimg = canvas.toDataURL("image/png");
这应该可以解决问题

Yeah you can try to convert the google chart to a canvas and then get png image data from that, this will allow you to send png image data to libraries such as FPDF in which you can save the image as a PDF.
Google charts are created using SVG ... to convert SVG to canvas you can use the library canvg. It works like canvg(yourCanvas, yourSVG) then use var PNGimg = canvas.toDataURL("image/png");
This should pretty much do the trick

老子叫无熙 2024-09-19 10:08:32

没有简单的方法可以做到这一点。由于谷歌的可视化图表是用 javascript 制作的,如果你想要它作为图像,你几乎是无助的。

There isn't a simple way to do this. Since visualization charts with google are made with javascript you are pretty much helpless if you want it as an image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文