node.js - specify PDF page size using pdfkit in node js -


i read in pdfkit manual pdf page can sized using size[width,height].but when tried following code not working

var pdfdocument = require('pdfkit');  var doc = new pdfdocument; doc.size=[50,50]; doc.end() 

after exploration found following code working me create pdf document of size width,height , margins variables

 var pdfdocument = require('pdfkit');      var fs = require("fs");     var doc=new pdfdocument({         size: [width,height],         margins : { // default, 72             top: 10,            bottom:10,             left: 10,           right: 10         } }) 

Comments