Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant convert image some file PDF #116

Open
binhleon opened this issue Aug 19, 2021 · 5 comments
Open

Cant convert image some file PDF #116

binhleon opened this issue Aug 19, 2021 · 5 comments

Comments

@binhleon
Copy link

  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
Copy link
Author

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

@vvnsze
Copy link

vvnsze commented Aug 24, 2021

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

@binhleon
Copy link
Author

try to change format to png it work for me

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

@yakovmeister
Copy link
Owner

  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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants