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

Failed to convert page to image #42

Open
siamraj opened this issue Jul 10, 2018 · 1 comment
Open

Failed to convert page to image #42

siamraj opened this issue Jul 10, 2018 · 1 comment

Comments

@siamraj
Copy link

siamraj commented Jul 10, 2018

issues

My Code :
var fs = require('fs');
var PDFImage = require("pdf-image").PDFImage;

var pdfImage = new PDFImage("test.pdf");
pdfImage.convertPage(0).then(function (imagePath) {
// 0-th page (first page) of the slide.pdf is available as slide-0.png
fs.existsSync("Public/slide-0.png") // => true
}).catch((err)=>{
console.log(err)
});

Error MSG :

{ message: 'Failed to convert page to image',
error:
{ Error: Command failed: convert "test.pdf[0]" "test-0.png"
Invalid Parameter - "test-0.png"

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:554:12)
 killed: false,
 code: 4,
 signal: null,
 cmd: 'convert "test.pdf[0]" "test-0.png"' },

stdout: '',
stderr: 'Invalid Parameter - "test-0.png"\r\n' }

@roest01
Copy link
Contributor

roest01 commented Jul 10, 2018

Hey @siamraj,
You have this problem because the convert process didn't worked.
The error message might can be optimised here but primarily you have to fix the convert command.
Try this on your command line - this will fail:
convert "test.pdf[1]" "test-0.png"

You already found: #30

Try to install pdf-poppler or poppler with brew as described in readme

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

No branches or pull requests

2 participants