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

Improper image header #217

Open
lukaprijatelj opened this issue Nov 6, 2024 · 2 comments
Open

Improper image header #217

lukaprijatelj opened this issue Nov 6, 2024 · 2 comments
Labels

Comments

@lukaprijatelj
Copy link

lukaprijatelj commented Nov 6, 2024

Description of the error in console
/repo/node_modules/gm/lib/command.js:318
err = new Error('Command failed: ' + stderr);
^

Error: Command failed: gm convert: Improper image header (/var/folders/cs/l780tq_j2f70ml2j7qxzyp3w0000gp/T/gmCFO1v4).
at ChildProcess.onExit (/repo/node_modules/gm/lib/command.js:318:17)
at ChildProcess.emit (node:events:520:28)
at maybeClose (node:internal/child_process:1105:16)
at Socket. (node:internal/child_process:457:11)
at Socket.emit (node:events:520:28)
at Pipe. (node:net:337:12) {
code: 1,
signal: null
}

To Reproduce
Steps to reproduce the behavior:

  1. Create nodeJS server
  2. add code from pdf2image readme file
  3. start server
  4. error occurs when you try to convert local pdf file

Versions:

  • OS: MacOS
  • Node version: v22.1
  • pdf2pic version 3.1.3
  • graphicsmagick/imagemagick version: 1.3.45
  • ghostscript version: 10.04.0

Pdf I am trying to convert is very minimal 1 test page that I made from Word and is not protected!
Please help! No idea what I am doing wrong!

========== My code:
const options =
{
saveFilename: "untitled",
savePath: "./images",
};
const convert = fromPath(filePath, options);
const pageToConvertAsImage = 1;

convert(pageToConvertAsImage, { responseType: "image" })
.then((resolve) => {
console.log("Page 1 is now converted as image");
return resolve;
});

@mskec
Copy link
Collaborator

mskec commented Nov 14, 2024

Hi @lukaprijatelj, can you try your code with another PDF? Maybe pdf1 from this repository https://github.com/yakovmeister/pdf2image/blob/master/test/data/pdf1.pdf

@lukaprijatelj
Copy link
Author

Nop. Same issue.

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

No branches or pull requests

2 participants