是否可以将 JavaScript 生成的图像保存在服务器端?

发布于 2024-11-17 08:30:08 字数 239 浏览 4 评论 0原文

我想使用JSChart(http://www.jscharts.com/)生成动态图表。

它使用 对象。

此外,我想将生成的图表保存为图像(放入 pdf 文件)在服务器端。

是否可以在服务器端将 JavaScript 生成的图像保存为 jpg 或 png 格式?

该解决方案最好能够与 Ruby 和 Ruby On Rails 配合使用。

I want to use JSChart (http://www.jscharts.com/) to generate a dynamic chart.

It uses a <canvas> object.

Furthermore I want to save the generated Chart as an image (to put in a pdf file) on the serverside.

Is it possible to save a JavaScript generated image as jpg or png on the serverside?

Preferably the solution should work with Ruby and Ruby On Rails.

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

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

发布评论

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

评论(2

薄暮涼年 2024-11-24 08:30:08

我认为这使用 对象来渲染图表,不下载就无法分辨,并且需要注册,所以不。如果确实如此,也许可以看看 Canvas2Image,它将画布作为数据 URL 返回, base64 编码的图像,可以通过 AJAX 调用发送回服务器。

I think this uses a <canvas> object to render the charts, can't tell without downloading and it requires registration, so no. If it does, perhaps take a look at Canvas2Image, that returns the canvas as a data URL, base64 encoded image, which could be sent back to the server via an AJAX call.

旧人九事 2024-11-24 08:30:08

您可以在服务器上使用 http://xmlgraphics.apache.org/batik/ 来转换 SVG 。这是 highcharts 用于转换应用程序生成的图表的方法。请参阅 http://www.highcharts.com/docs/export-模块/设置服务器

You can use http://xmlgraphics.apache.org/batik/ on the server to convert an SVG. It's the method used by highcharts to convert the graph generated by the application. See http://www.highcharts.com/docs/export-module/setting-up-the-server

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