Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
657 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. // Please note: When loading paper as a normal module installed in node_modules,
  2. // you would use this instead:
  3. // var paper = require('paper-jsdom-canvas');
  4. var paper = require('../../dist/paper-core.js');
  5. var path = require('path');
  6. var fs = require('fs');
  7. var canvas = paper.createCanvas(612, 792, 'pdf');
  8. paper.setup(canvas);
  9. fs.readFile('./in.json', { encoding: 'utf8' }, function (err, data) {
  10. if (err)
  11. throw err;
  12. paper.project.importJSON(data);
  13. paper.view.update();
  14. fs.writeFile(path.resolve('./out.pdf'), canvas.toBuffer(), function (err) {
  15. if (err)
  16. throw err;
  17. console.log('Saved!');
  18. });
  19. });