New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dom-capture

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-capture

实现了HtmlElement的截图功能

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

HTML截图

实现了HtmlElement的截图功能

Install

yarn add dom-capture
or
npm i dom-capture

Usage

import {capture} from 'dom-capture'

const result = await capture(document.getElementById('poster'));
let img = new Image();
img.src = result;
document.body.appendChild(img);

RenderOptions

名称类型必须默认值说明
type'canvas' | 'jpeg' | 'png' | 'blob''png'导出类型
qaulitynumber0.7导出图片质量

开启调试

window['dom-capture/debug-mode'] = true

注意点

  • 仅支持的元素有:imgtextcanvas(svga/spine/lottie)
  • 不支持transform变换
  • 文本仅只是Arial字体,建议给元素设置为Arial字体
  • 1.0.28开始支持自定义字体,前提是确保设备上有字体或者引入了字体
  • 不支持z-index样式
  • 不支持下划线样式
  • 不支持所有滤镜
  • 不支持文本超出点点点(ellipsis)
  • 不支持img填充样式
  • 不支持overflow样式
  • 不支持跨域的图片
  • 换行文本需要加样式:overflow-wrap: break-word;

FAQs

Package last updated on 25 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc