2

I am trying to convert pdf to image using pdfplumber in python (IDE JUPYTER)

I have tried following code

with pdfplumber.open("path to pdf") as pdf:
     first_page = pdf.pages[0]
im = first_page.to_image()

I have downloaded the dependencies ImageMagick and ghostscript and also defined the system path in environment variables

I am getting following error:

DelegateError: FailedToExecuteCommand `"gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/Users/irg/AppData/Local/Temp/magick-xwn2OA2S47mta_1fpsoqvDw2WyROBAJq%d" "-fC:/Users/irg/AppData/Local/Temp/magick-FzpgZxweNEIZ03bmz0yeYtNa8wctH3sw" "-fC:/Users/irg/AppData/Local/Temp/magick-PdLhGJhkX1m7ozduIxlzmXaLKEegAz98"' (The system cannot find the file specified.) @ error/delegate.c/ExternalDelegateCommand/475

Please help me to get rid of this issue.

Vishal Singh
  • 6,014
  • 2
  • 17
  • 33
Shyam
  • 357
  • 1
  • 9
  • 3
    You need to install Ghostscript delegate with ImageMagick in order to process PDF files. Does `convert -version` list gs or gslib? It looks like ImageMagick did not find GS when it was compiled or GS was not installed properly. The other issue is possibly https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Sep 11 '20 at 16:25
  • Thanks, the issue is resolved the mistake I made that I have created new env. variable for saving path instead of saving in Path variable.. – Shyam Sep 15 '20 at 08:34

0 Answers0