Socket
Socket
Sign inDemoInstall

easy-dom2img

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    easy-dom2img

a easy use dom-to-img tools


Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Install size
69.9 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 03 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc