开源介绍 - html2canvas

在这里插入图片描述

What is html2canvas ?

The script allows you to take “screenshots” of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.

这个脚本允许你自己对浏览器上的整个页面或部分进行截图,屏幕截图基于DOM元素进行,因此可能部署百分之百准确的真实表现,他并不是对屏幕截图,而是通过页面上的信息去构建屏幕截图。

注官网链接:https://html2canvas.hertzen.com/

How it works ?

The script traverses through the DOM of the page it is loaded on. It gathers information on all the elements there, which it then uses to build a representation of the page. In other words, it does not actually take a screenshot of the page but builds a representation of it based on the properties it reads from the DOM.

该脚本遍历它所加载的页面的 DOM。它收集那里所有元素的信息,然后使用这些信息来构建页面的表示。换句话说,它实际上并没有截取页面的屏幕截图,而是根据它从 DOM 读取的属性构建它的表示。

As a result, it is only able to render correctly properties that it understands, meaning there are many CSS properties which do not work. For a full list of supported CSS properties, check out the supported features page.

结果,它只能正确渲染它理解的属性,这意味着有许多 CSS 属性不起作用。有关支持的 CSS 属性的完整列表,请查看 支持的功能页面。

在这里插入图片描述
在这里插入图片描述

Limitations

All the images that the script uses need to reside under the same origin for it to be able to read them without the assistance of a proxy. Similarly, if you have other canvas elements on the page, which have been tainted with cross-origin content, they will become dirty and no longer readable by html2canvas.

脚本使用的所有图像都需要位于同一源下,以便无需代理 的帮助即可读取它们。同样,如果canvas 页面上有其他元素被跨域内容污染,它们将变脏并且不再被 html2canvas 读取。

The script doesn’t render plugin content such as Flash or Java applets.

该脚本不呈现插件内容,例如 Flash 或 Java 小程序。

  • 23
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值