Image in pdfkit not displaying?

154 views Asked by At

I am using pdfkit to generate a pdf file in Node JS, but I am having trouble to display an image. The image is in the same folder as my Node javascript file, but it keeps telling me "no such file or directory".

I tried all the following:

doc.image('./Logo.png');
doc.image('/Logo.png');
doc.image('Logo.png');

What am I missing here?

1

There are 1 answers

0
Ike Anya On

I tried using pdf.image('./img.png') and it never worked. But when i tried pdf.image('rootDirectory/Subfolder/img.png'), it worked.

Hope this helps.