将HTML转换为图像 [英] Render HTML to an image

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

问题描述

有什么方法来渲染html到像PNG的图像?我知道这是可能的画布,但我想渲染标准的html元素,如div。

Is there a way to render html to image like PNG? I know that it is possible with canvas but I would like to render standard html element like div for example.

推荐答案

是的。存在 HTML2Canvas 以将HTML呈现到< canvas>

Yes. HTML2Canvas exists to render HTML onto <canvas> (which you can then use as an image).

注意:有一个已知的问题,这将不适用于SVG

NOTE: There is a known issue, that this will not work with SVG

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

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