是否可以将 JavaScript 生成的图像保存在服务器端?
我想使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这使用
对象来渲染图表,不下载就无法分辨,并且需要注册,所以不。如果确实如此,也许可以看看 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.您可以在服务器上使用 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