document using with node.js
This commit is contained in:
parent
c1cb3c284e
commit
273fd09ca7
18
README.md
18
README.md
@ -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.
|
||||
|
||||
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
|
||||
==========
|
||||
- v1.0.15 Setup travis, add testharness and debug playground, and fix regression for __createElement refactor
|
||||
|
Loading…
x
Reference in New Issue
Block a user