GitXplorerGitXplorer
w

node-rsvg

public
98 stars
48 forks
9 issues

Commits

List of commits on branch master.
Unverified
565408823d98886d4dd1feca763bfc76dfbb2a45

Merge branch 'release/0.2.5'

wwalling committed 11 years ago
Unverified
01976c9c5b81b8b186940b87b09ba3435a7f3daf

Bumping version number.

wwalling committed 11 years ago
Unverified
a4cbb67ebea2644051e33b629cf738ccd833da04

Merge branch 'master' into develop

wwalling committed 11 years ago
Unverified
a1b1c7da3bba386f9fbe1539a4b3e57870bd5449

Merge branch 'master' of github.com:walling/node-rsvg

wwalling committed 11 years ago
Unverified
1657859e6dd7a91c498385f2faa1e9b1f5294ba5

Merge branch 'release/0.2.4' into develop

wwalling committed 11 years ago
Unverified
0072c58f55e140b80c5ce56f6ad0bb277d1c5790

Merge branch 'release/0.2.4'

wwalling committed 11 years ago

README

The README file for this repository.

Node.JS Binding for LibRSVG

LibRSVG is a SVG rendering library, which parses SVG files and renders them in various formats. The formats include:

  • PNG
  • PDF
  • SVG
  • Raw memory buffer image

Build Status

Basic Usage

Here is a simple example. Look in index.js for more documentation.

var Rsvg = require('rsvg').Rsvg;
var fs = require('fs');

// Create SVG render instance.
var svg = new Rsvg();

// When finishing reading SVG, render and save as PNG image.
svg.on('finish', function() {
  console.log('SVG width: ' + svg.width);
  console.log('SVG height: ' + svg.height);
  fs.writeFile('tiger.png', svg.render({
    format: 'png',
    width: 600,
    height: 400
  }).data);
});

// Stream SVG file into render instance.
fs.createReadStream('tiger.svg').pipe(svg);

Installation

First install the LibRSVG library and header files. Usually you have to look for a development package version. You must also have a functioning build tool chain including pkg-config. You can find instructions for different operating systems below. After that, you simply run:

npm install rsvg

Library versions known to work:

  • LibRSVG 2.26+
  • Cairo 1.8.8+

Ubuntu:

sudo apt-get install librsvg2-dev

RedHat / OpenSUSE:

sudo yum install librsvg2-devel

Mac OS X:

brew install librsvg

If, after installing LibRSVG through homebrew you are experiencing issues installing this module, try manually exporting the package config with this command:

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

Then try reinstalling this module. For further information, see this thread.

Windows:

N/A; pull requests are accepted!