Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.
This repository was archived by the owner on Apr 15, 2020. It is now read-only.

Failed to convert page to image #61

@VolckaertAchiel

Description

@VolckaertAchiel

hi, i have this code in nodejs that receives a pdf, and converts it to an image, which it will respond the location on server and in base64. this works perfectly on mac. when deployed to docker it fails with:

{ message: 'Failed to convert page to image',
error:
{ Error: Command failed: convert "services/uploads/1f4ca0ff9901c719b201007b102c18e2[0]" "services/uploads/1f4ca0ff9901c719b201007b102c18e2-0.png"
convert-im6.q16: no images defined `services/uploads/1f4ca0ff9901c719b201007b102c18e2-0.png' @ error/convert.c/ConvertImageCommand/3258.

at ChildProcess.exithandler (child_process.js:281:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
 killed: false,
 code: 1,
 signal: null,
 cmd: 'convert "services/uploads/1f4ca0ff9901c719b201007b102c18e2[0]" "services/uploads/1f4ca0ff9901c719b201007b102c18e2-0.png"' },

stdout: '',

let pdfImage = new PDFImage("services/uploads/" + req.file.filename)
pdfImage.convertPage(0)
.then(function (imagePath) {
googleCloudService.uploadPDFconvImg(req.file.filename + "-0.png")
.then((result) => {
let base64 = Buffer(fs.readFileSync("services/uploads/" + req.file.filename+ "-0.png")).toString('base64')
fs.unlinkSync("services/uploads/" + req.file.filename+ "-0.png");
fs.unlinkSync("services/uploads/" + req.file.filename);

                    res.status(200).json({
                        url:result.Location,
                        image:base64
                    });
                    // resolve(result)
                })
                .catch(error => {
                    console.log("error on image upload")
                    console.log(error)

                    res.status(400).json({ error: "Could not upload file" })
                });
        })

someone has an idea how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions