node-pdf-image
node-pdf-image copied to clipboard
Failed to convert page to image'
my envoriment is node : 6.9.1 os:windows 10
var pdfImage = new PDFImage('test.pdf');
pdfImage.convertPage(0).then(function (imagePath) {
console.log(imagePath)
// 0-th page (first page) of the slide.pdf is available as slide-0.png
fs.existsSync(imagePath) // => true
}).catch(function(error){console.log(error)});
{ 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:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)
killed: false,
code: 4,
signal: null,
cmd: 'convert \'test.pdf[0]\' \'test-0.png\'' },
stdout: '', stderr: 'Invalid Parameter - 'test-0.png'\r\n' }
+1
Looks that the problem is with convert, not with node-pdf-image, checkup the path of the file you're giving
same issue here.. what's the problem with convert? I think we need more information here..
This fail when the input path contain ":" and probably other characters, changing the filename solved the problem. Maybe use the absolute path.
Same issue .
Same issue.
Use package pdf-poppler i have tried it and it works fine
Same issue is here
same issue
Same issue is here.
I've found some workaround of that - look at this comment please.
Downgrading GhostScript to 9.23 worked for me..
though haven't tried on Windows, works on MacOS for sure..
https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/tag/gs923
confirmed on Windows as well.. after downgrading GhostScript to 9.23 we have no issue such as 'Invalid Parameter - 'test-0.png'.. pdfImage.convertPage(0) method works fine, whereas pdfImage.convertFile() doesn't!