0

I want to write a python code that reads a pdf file and convert it to images following this tutorial : https://www.youtube.com/watch?v=pf7OONW7l54 and https://www.youtube.com/watch?v=jRUcMiXZt5Q

so wile writing this part of the code :

import io 
from PIL import Image 
import pytesseract
from wand.image import Image as wi 

pdf = wi(filename="pub.pdf", resolution = 300)#reading the pdf file

i had this error

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Asus\anaconda3\envs\venv\lib\site-packages\wand\image.py", line 9110, in __init__
self.read(filename=filename)
File "C:\Users\Asus\anaconda3\envs\venv\lib\site-packages\wand\image.py", line 9705, in read
self.raise_exception()
File "C:\Users\Asus\anaconda3\envs\venv\lib\site-packages\wand\resource.py", line 222, in 
raise_exception
raise e
wand.exceptions.DelegateError: FailedToExecuteCommand `"gswin64c.exe" -q -dQUIET -dSAFER -dBATCH - 
dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" - 
dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300"  "- 
sOutputFile=C:/Users/Asus/AppData/Local/Temp/magick-jlrGdszT8qWK8pM53VwMFuYRSdTVjymB%d" "- 
fC:/Users/Asus/AppData/Local/Temp/magick-k6Nf5xta1tYaVH6IZHEmURi9oTeBo9RS" "- 
fC:/Users/Asus/AppData/Local/Temp/magick-LLJ1vviI92fdUzOeVz1c_HgjVw0DDxc4"' (Le fichier sp�cifi� 
est introuvable.
) @ error/delegate.c/ExternalDelegateCommand/510
eya_bklt
  • 305
  • 3
  • 10
  • Did you install [ghostScript](https://www.ghostscript.com/)? – Ahmet Mar 10 '21 at 18:10
  • i did but the script crashes then i tried to change the pdf file it works! i don't know why it works in some pdfs and not on others – eya_bklt Mar 11 '21 at 13:15

0 Answers0