html2svg

1.0.1 • Public • Published

Build Status

html2svg convertor

A converter which could convert HTML document to SVG image.

Even if a JS-Rendered HTML!

Installation

Available on NPM as fetch.

 
$ npm install html2svg
 

Usage

Implement Promise (es6)

 
const html2svg = require('html2svg');
const input = 'file:///root/path/file.ext'; // Or: http://google.com
const output = '/root/path/file.ext';
const needJSRender = true;
 
html2svg({input, output, needJSRender}).then(res => {
    console.log(res);
}).catch(err => {
    console.error(err);
});
 

Work with async-await (es7)

const html2svg = require('html2svg');
const input = 'file:///root/path/file.ext'; // Or: http://google.com
const output = '/root/path/file.ext';
 
(async function() {
 
  try {
    let res = await html2svg({input, output});
 
    console.log(res);
  } catch(err) {
    console.error(err)
  }
 
}());

Config

Param Description required default tip
input Input path. true null File URIs or HTTP URIs
output Ouput path with file name. true null -
needJSRender Tell it whether process JS Rendering or not. false null -

Support

Please open an issue for support.

Readme

Keywords

Package Sidebar

Install

npm i html2svg

Weekly Downloads

16

Version

1.0.1

License

ISC

Last publish

Collaborators

  • mrpeak