I read in pdfkit manual that pdf page can be sized using size[width,height].But when i tried the following code its not working
var PDFDocument = require('pdfkit');
var doc = new PDFDocument;
doc.size=[50,50];
doc.end()
After exploration i found the following code is working for me to create PDF document of any size with width,height and margins as variables
var PDFDocument = require('pdfkit');
var fs = require("fs");
var doc=new PDFDocument({
size: [width,height],
margins : { // by default, all are 72
top: 10,
bottom:10,
left: 10,
right: 10
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With