mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-30 01:54:44 +00:00
Options for node-canvas
Allowing to write pdf via node-canvas
```var canvas = fabric.createCanvasForNode(200, 200,'pdf');
..
fs.writeFile('out.pdf', canvas.nodeCanvas.toBuffer());```
This commit is contained in:
parent
c664de7052
commit
107dd5735f
1 changed files with 4 additions and 2 deletions
|
|
@ -137,12 +137,14 @@
|
|||
* @param width Canvas width
|
||||
* @param height Canvas height
|
||||
* @param {Object} options to pass to FabricCanvas.
|
||||
* @param {Object} options to pass to NodeCanvas.
|
||||
* @return {Object} wrapped canvas instance
|
||||
*/
|
||||
fabric.createCanvasForNode = function(width, height, options) {
|
||||
fabric.createCanvasForNode = function(width, height, options, nodeCanvasOptions) {
|
||||
nodeCanvasOptions = nodeCanvasOptions || options;
|
||||
|
||||
var canvasEl = fabric.document.createElement('canvas'),
|
||||
nodeCanvas = new Canvas(width || 600, height || 600);
|
||||
nodeCanvas = new Canvas(width || 600, height || 600, nodeCanvasOptions);
|
||||
|
||||
// jsdom doesn't create style on canvas element, so here be temp. workaround
|
||||
canvasEl.style = { };
|
||||
|
|
|
|||
Loading…
Reference in a new issue