freeman-lab / pdf-to-png

render a PDF to a PNG with electron
MIT License
40 stars 8 forks source link

It not seems to work #9

Open hd-esteban opened 4 years ago

hd-esteban commented 4 years ago

I have a very basic implementation and it doesn't work, I see how electron is opened on the navigation bar, but the callback is not getting executed and the file is not created.

let sourcePdfFilePath = path.resolve(./tmp/${fileObj.originalname}); let outputThumbFilePath = path.resolve(./tmp/${fileObj.originalname.split('.').slice(0, -1).join('.')}${extensions.PNG});

fs.writeFileSync(sourcePdfFilePath, fileObj.buffer, (err) => { if(err) { logger.error('Temporal PDF file could not be stored to create the thumb.'); } }); // At this point the pdf file is getting created

require('pdf-to-png')({ input: sourcePdfFilePath, output: outputThumbFilePath }, function() {console.log('Convertion completed.........!!!!!!')});

KarenVelasco commented 3 years ago

It also doesn't work for me

anti-the-social commented 2 years ago

Hi guys :) npm i node-ensure to your project and it would work. For some reason that dependency is missing.