To create a PDF document, we will need to import the fs (file system) module as well. We'll pipe the contents of our PDF file into a fs 's writeable stream to save it. Let's take a look at how to do that. const PDFDocument = require('pdfkit'); const fs = require('fs'); let pdfDoc = new PDFDocument; pdfDoc.