I have Python 3.6 and want to know how to convert 30+ pdf images into jpgs. I have these pdf images stored in one folder and would like to run a script to run through all the pdfs, convert them to jpgs and split them out into a new folder.
I tried to test this out on one image (see code below):
import pdf2jpg as pdf2jpg
inputpath = r"C:\Users\Admin-dsc\Documents\Image project\pdfinputs\RWG003209_2 Red.pdf"
outputpath = r"C:\Users\Admin-dsc\Documents\Image project\jpgoutputs"
result = pdf2jpg.convert_pdf2jpg(inputpath, outputpath, pages="1")
print(result)
but I keep getting the following error message which I don't understand:
Traceback (most recent call last):
File "<ipython-input-27-050be63282af>", line 11, in <module>
result = pdf2jpg.convert_pdf2jpg(inputpath, outputpath, pages="1")
AttributeError: module 'pdf2jpg' has no attribute 'convert_pdf2jpg'
Any help would be appreciated as I am very new to Python.
I guess you need to use from pdf2jpg import pdf2jpg
instead of import pdf2jpg as pdf2jpg
- these are two different statements.