1.0.2 • Published 10 days ago

easy-dom2img v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
10 days ago

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

  */
})
1.0.2

10 days ago

1.0.1

4 months ago

1.0.0

4 months ago