Socket
Book a DemoInstallSign in
Socket

easy-dom2img

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-dom2img

a easy use dom-to-img tools

latest
npmnpm
Version
1.0.2
Version published
Weekly downloads
2
-86.67%
Maintainers
1
Weekly downloads
 
Created
Source

easy-dom2img

a dom-to-image tools writing in typescript, which is powerful and easy to use

code samples

import dom2Img, { AutoFitByRatio } from "easy-dom2img";

const dom =  document.getElementById("resume")

const {
  data: imgUrl,   // result will return as base64 data url
  width,          // the image's width
  height,         // the image's height
} = await dom2Img(dom, {
  width: 1000,              // the rendered image's width you want, default is AutoFitByRatio
  height: AutoFitByRatio,   // the rendered image's width you want, default is AutoFitByRatio
  /* Here are some optional params...

  filter: (node: Node) => { // filter node function which you can filter the dom you dont want to be rendered
    return true
  },

  bgcolor: '#fff',          // the rendered image background color

  placeholder: 'data:XXXX'  // the placeholder image which is base64 data url

  noCache: false            // indicate if the resource request from url using cache or not

  */
})

Keywords

image

FAQs

Package last updated on 30 Apr 2024

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