yakovmeister / pdf2image

A utility for converting pdf to image and base64 format.
MIT License
435 stars 141 forks source link

Getting a warning when trying to convert a PDF to image with more than 10 pages #120

Closed jinuperfo closed 3 years ago

jinuperfo commented 3 years ago

`const pdf2pic = require("pdf2pic"); const options = { saveFilename: "8.21_POLICE.FSO", savePath: "./uploads", format: "jpg", width: 2550, height: 1250, density: 150 };

const storeAsImage = pdf2pic.fromPath("./uploads/8.21_POLICE.FSO.pdf", options).bulk; const pageToConvertAsImage = -1;

storeAsImage(pageToConvertAsImage). then((resolve) => { console.log("Page 1 is now converted as image"); return resolve; }).catch(err=>{ console.log("error",err) })`

When i try to execute this code, its showing this warning.

'(Use node --trace-warnings ... to show where the warning was created) (node:24620) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [ReadStream]. Use emitter.setMaxListeners() to increase limit'

I followed this solution in https://stackoverflow.com/questions/8313628/node-js-request-how-to-emitter-setmaxlisteners to hide this warning. What's the best way to solve this issue? In my case i may have to deal with PDFs with 100-200 pages.

jinuperfo commented 3 years ago

This issue was already reported and its still open. so closing this one