foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser
http://pdfkit.org/
MIT License
9.89k stars 1.15k forks source link

DeprecationWarning #1504

Open david-benistant opened 7 months ago

david-benistant commented 7 months ago

Code sample

 doc.image(path.join(__dirname, '../../../../assets/myLogo.png'), 390, 20, { width: 180 });

Bug Report

I got a Deprecation warning when i put an image on my pdf

this line cause me this error: (node:127) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

When the file extension is .jpg there is no error.

Run in a lambda with serverless offline

blikblum commented 7 months ago

I cannot reproduce here Can you test with just released 0.15.0?

david-benistant commented 7 months ago

I tried with 0.15.0, still have the error. I use typescript and "@types/pdfkit": "^0.13.4",

blikblum commented 7 months ago

Please provide a online example using https://repl.it/@blikblum/minimal-pdfkit