将呈现的HTML保存为图像 [英] Save rendered HTML as image

查看:84
本文介绍了将呈现的HTML保存为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个需要将div导出到图像的web应用程序。该div将包含图像,其他div,用css样式的文本等等。最后,用户应该有一张图像,看起来就像他截取了该div的截图一样。我查看了服务器端的php库,但是我没有看到任何能够处理呈现的HTML复杂性的东西。 HTML5画布具有该功能,但我无法为我的情况使用画布。任何想法?



谢谢!

解决方案

=http://html2canvas.hertzen.com/ =nofollow> html2canvas 。在canvas元素上呈现页面内容的JavaScript框架。

I am building a web app that needs to export a div to an image. That div will contain images, other divs, text with css styling, etc. At the end, the user should have an image that would look the same as if he had taken a screenshot of that div. I 've looked into server-side php libs but I don't see anything that would handle the complexity of the rendered HTML. HTML5 canvas has that capability but I can't use a canvas for my case. Any ideas?

Thanks!

解决方案

Check out html2canvas. A javascript framework that renders the page content on a canvas element.

这篇关于将呈现的HTML保存为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆