0

I am trying to convert pdf file(which is scanned image with extension .pdf) into .jpg which is having multi pages using Python 3.6 with PythonMagick 0.9.13, ghostscript 0.6. All have been installed from PyCharm Interpreter Package. OS-Windows10 64 bit

It was working fine for some time, but now its giving me an below error, i tried to find fix this by looking into suggestions given in all below links, nothing worked out. Can any one please help me to fix this? it would be great!!
Error with ImageMagick and Ghostscript converting from PDF

Imagemagick Convert PDF to JPEG: FailedToExecuteCommand `"gswin32c.exe" / PDFDelegateFailed

****************************Error Message********************

RuntimeError: Magick: PDFDelegateFailed `[ghostscript library 9.09] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/Users/****/AppData/Local/Temp/magick-13092f9RE6HZSrtFU%d" "-fC:/Users/****/AppData/Local/Temp/magick-13092ks9r_NT8Xygw" "-fC:/Users/****/AppData/Local/Temp/magick-13092NNqfnGb-iNhM"': Unrecoverable error: invalidaccess in put Operand stack: true false --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- InputAttributes --nostringval-- --nostringval-- InputAttributes --nostringval-- @ error/pdf.c/InvokePDFDelegate/274

ras
  • 41
  • 1
  • 10

1 Answers1

0

Looks like you have an invalid PDF file. You also have an ancient version of Ghostscript, 9.09 is 5 years old and I'd start by trying the current version instead.

I'd also try just opening the PDF file with Ghostscript to see whether that works, if it doesn't then I'd need to have the original PDF file to say why.

One thing that is relevant, though you may not be able to change it, is; Don't use -dUseCIEColor.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • I Am new to the Ghostscript, this is the first time i am installing this. It would be great if you could give me some links from where i can download .exe/whl files and upgrade it. – ras Sep 13 '18 at 14:08
  • You are right, thats the issue with the file format which i was using!!! i tested with some other files which works fine for existing code. Thanks for identifying this. – ras Sep 13 '18 at 14:39
  • You can get the Ghostscript Windows binaries from the Ghostscript web site (www.ghostscript.com). Version 9.25 has **just** been released with a number of important security fixes. All users are urged to upgrade to this version as soon as possible. – KenS Sep 13 '18 at 15:09