I am writing a code that allows to create a pdf file using pdfkit nodejs package, this pdf file contains images that I have in a folder on my machine but when I run it gives me an empty pdf file

var pdf = require('pdfkit');
var fs = require('fs');
var url = require('./sreenshot.js');
var myDoc = new pdf;
 // Add  images, constrain it to a given size, and center it vertically and 

for(var i= 0; i < url.length; i++){
 const img = ['./Screenshots/capture'+ i +'.png']
 for(var j= 1; j < img.length; j++){
myDoc.image(img[0], {
  fit: [250, 300],
  align: 'center',
  valign: 'center'});
 .image(img[j], {
fit: [250, 300],
align: 'center',
valign: 'center'



0 Answers