Skip to content

MrPeak/html2svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

html2svg convertor (Deprecated! Wait for new version,which engine is written by pure-js)

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.

About

Convert html to svg.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors