pdf2image
pdf2image copied to clipboard
Cant convert image some file PDF
const options = {
density: 600,
saveFilename: req.file.filename,
savePath: `${appRoot}/${process.env.UPLOAD_PDF_DIR}`,
format: "jpg",
width: 600,
height: 600
};
console.log("[pdf2pic] req.file.path = ", req.file.path);
const convert = fromPath(req.file.path, options);
convert.bulk(-1, true).then(resolve => {
console.log(resolve)
req.convertInfo = resolve;
next();
}).catch(err => {
console.log("[pdf2pic][convert]", err);
return next(err);
});
I can convert some other PDF file with resolution around 5xx, but have 1 file with resolution 5xxx then it stuck and cant move to other step. It take long time and slow my PC but not return any error. I dont know why it happen , please help me what should i do in this case
I found solution to update this file by set density:100 but anyway we can detect file pdf to set density?
Running into issue where even if I set density to 100, it errors out
try to change format to png it work for me
Running into issue where even if I set density to 100, it errors out
const options = { density: 600, saveFilename: req.file.filename, savePath: `${appRoot}/${process.env.UPLOAD_PDF_DIR}`, format: "jpg", width: 600, height: 600 }; console.log("[pdf2pic] req.file.path = ", req.file.path); const convert = fromPath(req.file.path, options); convert.bulk(-1, true).then(resolve => { console.log(resolve) req.convertInfo = resolve; next(); }).catch(err => { console.log("[pdf2pic][convert]", err); return next(err); });
I can convert some other PDF file with resolution around 5xx, but have 1 file with resolution 5xxx then it stuck and cant move to other step. It take long time and slow my PC but not return any error. I dont know why it happen , please help me what should i do in this case
It could probably be that the resolution is too big to handle. I will do some testing from my end to see if that is the case.
Running into issue where even if I set density to 100, it errors out
@vvnsze which error message are you getting? can you send me the stack trace? thanks.