Skip to content

Changing the Document size

David Foster edited this page Jul 10, 2020 · 4 revisions

The PDFDocument takes some options when initializing.

var doc = new PDFDocument({
  size: 'legal',
  layout: 'landscape' // default is portrait
});

Other size options include letter, or you can use an array to specify dimensions. A list of available size options can be found here

var doc = new PDFDocument({
  layout: 'landscape',
  size: [200, 350] // a smaller document for small badge printers
});

You can also change the default margin

var doc = new PDFDocument({
  margin: 50 // defaults to 72, which is an inch on a 72 pixels per inch document
});
Clone this wiki locally