html element to image
npm install @wfkit/elshot``bash`
pnpm i @wfkit/elshot
`js
import { createElShot } from '@wfkit/elshot'
// defautl
const shot = createElShot({
name: 'html-to-image',
})
// or html2canvas
const shot = createElShot({
name: 'html2canvas',
})
// or modern-screenshot
const shot = createElShot({
name: 'modern-screenshot',
})
// or @zumer/snapdom
const shot = createElShot({
name: '@zumer/snapdom',
})
// or custom
const shot = createElShot({
name: '
version: '
url: , // default: https://www.unpkg.com/${name}@${version}
toCanvas: (_el, _options) => {
// ...
},
})
// shot
// Options
// https://github.com/qq15725/modern-screenshot/blob/main/src/options.ts
// https://html2canvas.hertzen.com/configuration
// https://github.com/bubkoo/html-to-image?tab=readme-ov-file#Options
// https://github.com/zumerlab/snapdom#Options
await shot.toCanvas(el, options)
``
MIT © YDWF.COM