mooz / node-pdf-image

Provides an interface to convert PDF's pages to png files in Node.js by using ImageMagick
MIT License
237 stars 87 forks source link

Failed to convert page to image' #30

Open GHR-Arash opened 6 years ago

GHR-Arash commented 6 years ago

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' }

augurios commented 6 years ago

+1

cesargdm commented 6 years ago

Looks that the problem is with convert, not with node-pdf-image, checkup the path of the file you're giving

ghost commented 6 years ago

same issue here.. what's the problem with convert? I think we need more information here..

dam1 commented 6 years ago

This fail when the input path contain ":" and probably other characters, changing the filename solved the problem. Maybe use the absolute path.

MariSelvanDev commented 6 years ago

Same issue .

pilapila commented 6 years ago

Same issue.

Asma-Projects commented 6 years ago

Use package pdf-poppler i have tried it and it works fine

siamraj commented 6 years ago

Same issue is here

tiagoernst commented 6 years ago

same issue

m5x5 commented 6 years ago

Same issue is here.

pkantsedalov commented 5 years ago

I've found some workaround of that - look at this comment please.

jaykumarthaker commented 5 years ago

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

jaykumarthaker commented 5 years ago

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!