-1

I want to convert pdf text to image in python thats why im using pdf2image library.Now I'am able to convert only one pdf file. I have to convert multiple file from the folder. https://i.stack.imgur.com/gnxKK.png

petezurich
  • 7,683
  • 8
  • 34
  • 51

1 Answers1

1

This post is definitely something you should read. If you are newer to programming in general, you should also read up on Recursion and what it is (for-loops mainly).

Something like this may help you get to where you need to be but you will need to change it for your application. This uses 2 libraries that don't need to be installed manually (they come with python) os (which you are probably already using) and glob.

import os
from pdf2image import convert_from_path
import glob

path = os.path.dirname(__file__)
for filename in glob.glob(os.path.join(path, '*.pdf')):
    pages = convert_from_path(filename)

Glob Documentation

Column01
  • 142
  • 1
  • 12