node-pdf-image icon indicating copy to clipboard operation
node-pdf-image copied to clipboard

Failed to convert page to image'

Open GHR-Arash opened this issue 7 years ago • 13 comments
trafficstars

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

GHR-Arash avatar Dec 03 '17 12:12 GHR-Arash

+1

augurios avatar Jan 06 '18 06:01 augurios

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

cesargdm avatar Jan 07 '18 20:01 cesargdm

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

ghost avatar Jan 17 '18 18:01 ghost

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

dam1 avatar Feb 28 '18 19:02 dam1

Same issue .

MariSelvanDev avatar Mar 20 '18 13:03 MariSelvanDev

Same issue.

pilapila avatar May 16 '18 02:05 pilapila

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

Asma-Projects avatar May 16 '18 14:05 Asma-Projects

Same issue is here

siamraj avatar Jul 10 '18 12:07 siamraj

same issue

tiagoernst avatar Sep 04 '18 15:09 tiagoernst

Same issue is here.

m5x5 avatar Oct 11 '18 14:10 m5x5

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

pkantsedalov avatar Dec 04 '18 13:12 pkantsedalov

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 avatar Feb 12 '19 19:02 jaykumarthaker

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!

jaykumarthaker avatar Feb 14 '19 15:02 jaykumarthaker