mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-09 22:32:48 -05:00
878be7962e
Conflicts: src/path/Curve.js src/path/PathItem.Boolean.js src/util/Numerical.js
19 lines
537 B
JavaScript
19 lines
537 B
JavaScript
var paper = require('paper'),
|
|
path = require('path'),
|
|
fs = require('fs');
|
|
|
|
var canvas = new paper.Canvas(612, 792, 'pdf');
|
|
paper.setup(canvas);
|
|
with (paper) {
|
|
fs.readFile('./in.json', { encoding: 'utf8' }, function (err, data) {
|
|
if (err)
|
|
throw err;
|
|
project.importJSON(data);
|
|
view.update();
|
|
fs.writeFile(path.resolve(__dirname, 'out.pdf'), canvas.toBuffer(), function (err) {
|
|
if (err)
|
|
throw err;
|
|
console.log('Saved!');
|
|
});
|
|
});
|
|
}
|