pdf2image icon indicating copy to clipboard operation
pdf2image copied to clipboard

Cant convert image some file PDF

Open binhleon opened this issue 3 years ago • 5 comments

  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

binhleon avatar Aug 19 '21 10:08 binhleon

I found solution to update this file by set density:100 but anyway we can detect file pdf to set density?

binhleon avatar Aug 20 '21 07:08 binhleon

Running into issue where even if I set density to 100, it errors out

vvnsze avatar Aug 24 '21 22:08 vvnsze

try to change format to png it work for me

Running into issue where even if I set density to 100, it errors out

binhleon avatar Sep 30 '21 04:09 binhleon

  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.

yakovmeister avatar Nov 02 '21 05:11 yakovmeister

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.

yakovmeister avatar Nov 02 '21 05:11 yakovmeister