Skip to content

dodo/node-canvas-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-canvas-svg

drawing svg on a canvas in node.js.

Features

  • drawing svg data on canvas

Installation with git

git clone https://github.com/dodo/node-canvas-svg.git
cd node-canvas-svg
git submodules update --init
cd deps/node-canvas
make
cd ../node-overload
make

Motivation

NIH - not invented here ... srsly .. i want to generate some good looking charts without using javascript on client side (because this is lame for none-interactive images)

Dependencies

Usage

var canvassvg = require('node-canvas-svg');

First you need to load the canvg modules:

canvassvg.load(function (err, canvg_module) { … });

you can use as well the shorter from:

canvassvg.load(function (err) { … }); // the module is saved in canvassvg.svg.canvg

Drawing SVG

canvassvg.svg.render(svg, function (err, canvas) { … });

or

canvassvg.svg.render(canvas, svg, function (err, canvas) { … });

width and height can be applied as well:

canvassvg.svg.render(svg, width, height function (err, canvas) { … });

or

canvassvg.svg.render(canvas, svg, width, height function (err, canvas) { … });

Example

Fetching a svg file from wikipedia and return it as png:

TODO

  • More documentation
  • tests

About

drawing svg on a Canvas in Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published