svg2dataurl

1.0.2 • Public • Published

svg2dataurl

Convert SVG to SVG/PNG/JPEG DataURL. Just forked from likr/svg-dataurl and then do some modifications.

  1. Instead of commonsjs module ,use es6 module.
  2. Fix some issues.

Install

$ npm install svg2dataurl

Usage

import {SvgConverter} from 'svg2dataurl'

const svg = documentGetElementById('chart')
const downloadLink = documentGetElementById('#download-link')
SvgConverter.loadFromElement(svg).then((converter) => {
  const dataUrl = converter.pngDataURL()
  downloadLink.setAttribute('href', dataUrl)
})

/svg2dataurl/

    Package Sidebar

    Install

    npm i svg2dataurl

    Weekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    4.58 kB

    Total Files

    4

    Last publish

    Collaborators

    • webaifei