#Code for converting pdf to images
import os
from pdf2image import convert_from_path
pdf_dir = r"/home/shivam/Downloads/AMI_NEW_DUMP/AMI_CITY_OF_BREWTON"
os.chdir(pdf_dir)
for pdf_file in os.listdir(pdf_dir):
        print(pdf_file)
        print('this')
        if pdf_file.endswith(".pdf" or ".PDF"):

            pages = convert_from_path(pdf_file, 100)
            pdf_file = pdf_file[:-4]

            for page in pages:

               page.save("/home/shivam/Documents/orientation_detection/temp/%s-page%d.jpg" % (pdf_file,pages.index(page)), "JPEG")

b8a32a9abb7a0f5462a1dd78086f0bf12f3c7315
<mask token>

<mask token>
os.chdir(pdf_dir)
for pdf_file in os.listdir(pdf_dir):
    print(pdf_file)
    print('this')
    if pdf_file.endswith('.pdf' or '.PDF'):
        pages = convert_from_path(pdf_file, 100)
        pdf_file = pdf_file[:-4]
        for page in pages:
            page.save(
                '/home/shivam/Documents/orientation_detection/temp/%s-page%d.jpg'
                 % (pdf_file, pages.index(page)), 'JPEG')

<mask token>
pdf_dir = '/home/shivam/Downloads/AMI_NEW_DUMP/AMI_CITY_OF_BREWTON'
os.chdir(pdf_dir)
for pdf_file in os.listdir(pdf_dir):
    print(pdf_file)
    print('this')
    if pdf_file.endswith('.pdf' or '.PDF'):
        pages = convert_from_path(pdf_file, 100)
        pdf_file = pdf_file[:-4]
        for page in pages:
            page.save(
                '/home/shivam/Documents/orientation_detection/temp/%s-page%d.jpg'
                 % (pdf_file, pages.index(page)), 'JPEG')

import os
from pdf2image import convert_from_path
pdf_dir = '/home/shivam/Downloads/AMI_NEW_DUMP/AMI_CITY_OF_BREWTON'
os.chdir(pdf_dir)
for pdf_file in os.listdir(pdf_dir):
    print(pdf_file)
    print('this')
    if pdf_file.endswith('.pdf' or '.PDF'):
        pages = convert_from_path(pdf_file, 100)
        pdf_file = pdf_file[:-4]
        for page in pages:
            page.save(
                '/home/shivam/Documents/orientation_detection/temp/%s-page%d.jpg'
                 % (pdf_file, pages.index(page)), 'JPEG')

#Code for converting pdf to images
import os
from pdf2image import convert_from_path
pdf_dir = r"/home/shivam/Downloads/AMI_NEW_DUMP/AMI_CITY_OF_BREWTON"
os.chdir(pdf_dir)
for pdf_file in os.listdir(pdf_dir):
        print(pdf_file)
        print('this')
        if pdf_file.endswith(".pdf" or ".PDF"):

            pages = convert_from_path(pdf_file, 100)
            pdf_file = pdf_file[:-4]

            for page in pages:

               page.save("/home/shivam/Documents/orientation_detection/temp/%s-page%d.jpg" % (pdf_file,pages.index(page)), "JPEG")
