PDF TO IMAGE(pdf2img)

Hello lets start how we do PDF to img processing.

firtly we need download library

pip install pdf2image

Then we need import library

from pdf2image import convert_from_path

this command can pdf to img

images = convert_from_path("pdf path",poppler_path=r"Release-21.10.0-0\poppler-21.10.0\Library\bin")

for i in range(len(images)):
  images[i].save('path/'+ str(i) +'.jpg', 'JPEG')

“poppler_path” means when you want use py file as exe you need to poppler path. You can download poopler file this website click.

Bir cevap yazın