for (const file of images) { const probe = require('probe-image-size'); let result = await probe(fs.createReadStream(join(__dirname, path + "/" + file))); console.log("Adding for " + file); doc.addPage({ size: [width, height] }).image(join(__dirname, path + "/" + file), 0, 0, { align: 'center', valign: 'center', width: width, height: height }); } console.log("Created PDF for " + title + "."); doc.end();