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 #55

@VassilisPallas

Description

@VassilisPallas

Environment:
Node: 10
Os: ubuntu:18.04 (docker)

const path = './tmp';

const saveTempFile = (file, buffer) => { ... }

const readTempFile = file => { ... }

const deleteTempFile = file => { ... }

module.exports = async ({ originalname, buffer }) => {
  try {
    const extension = getExtension(originalname);
    const file = `${path}/${randonString()}${extension}`;
    await saveTempFile(file, buffer);

    const pdfImage = new PDFImage(file);
    const image = await pdfImage.convertPage(0);

    await deleteTempFile(file);
    return readTempFile(image);
  } catch (e) {
    throw e;
  }
};
{ message: 'Failed to convert page to image',
  error:
   { Error: Command failed: convert "./tmp/o22s9w2cqmjhlf0jawr1iq.pdf[0]" "tmp/o22s9w2cqmjhlf0jawr1iq-0.png"
   convert-im6.q16: not authorized `./tmp/o22s9w2cqmjhlf0jawr1iq.pdf' @ error/constitute.c/ReadImage/412.
   convert-im6.q16: no images defined `tmp/o22s9w2cqmjhlf0jawr1iq-0.png' @ error/convert.c/ConvertImageCommand/3258.
   
       at ChildProcess.exithandler (child_process.js:294:12)
       at ChildProcess.emit (events.js:198:13)
       at maybeClose (internal/child_process.js:982:16)
       at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
     killed: false,
     code: 1,
     signal: null,
     cmd:
      'convert "./tmp/o22s9w2cqmjhlf0jawr1iq.pdf[0]" "tmp/o22s9w2cqmjhlf0jawr1iq-0.png"' },
  stdout: '',
  stderr:
   'convert-im6.q16: not authorized `./tmp/o22s9w2cqmjhlf0jawr1iq.pdf\' @ error/constitute.c/ReadImage/412.\nconvert-im6.q16: no images defined `tmp/o22s9w2cqmjhlf0jawr1iq-0.png\' @ error/convert.c/ConvertImageCommand/3258.\n' }

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