You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
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"' },
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"
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"
stdout: '',
stderr: 'Invalid Parameter - "test-0.png"\r\n' }
The text was updated successfully, but these errors were encountered: