document using with node.js

This commit is contained in:
Conrad Irwin 2015-09-09 00:37:10 -07:00
parent c1cb3c284e
commit 273fd09ca7

View File

@ -80,6 +80,24 @@ You should now be able to select your new example from playground.html or see it
If you find a bug, or want to add functionality, please add a new test case and include it with your pull request. If you find a bug, or want to add functionality, please add a new test case and include it with your pull request.
Using with node.js
==================
You can use `canvas2svg` with node.js using [jsdom](https://github.com/tmpvar/jsdom) with [node-canvas](https://github.com/Automattic/node-canvas). To do this first create a new document object, and then create a new instance of `C2S` based on that document:
```javascript
var canvas = require('canvas'),
jsdom = require('jsdom'),
C2S = require('canvas2svg');
var document = jsdom.jsdom();
var ctx = new C2S({document: document});
// ... drawing code goes here ...
```
N.B. You may not need node-canvas for some simple operations when using jsdom >= 6.3.0, but it's still recommended that you install it.
Updates Updates
========== ==========
- v1.0.15 Setup travis, add testharness and debug playground, and fix regression for __createElement refactor - v1.0.15 Setup travis, add testharness and debug playground, and fix regression for __createElement refactor