def fedex(): box1 = (0, 0, 736, 862) box2 = (750, 462, 1700, 1100) box3 = (0, 90, 505, 300) folder = 'guide/' i = 1.0 total_files = 0 current_time = time.strftime("%d_%m_%Y") files = getPDF(folder) total_files = len(files) for fil in files: doc_name = fil.split('.') pdf2jpg(os.path.join(folder, fil)) cropJPG(box1, 'tmp/test1.jpg', 'tmp/testout1.jpg') cropJPG(box2, 'tmp/test1.jpg', 'tmp/testout2.jpg') cropRw(box3, 'tmp/testout2.jpg') mergeReport() jpg2docx('print/' + current_time + '_' + doc_name[0] + '.docx', 'tmp/testReport.jpg', 80) cleanup() print repr((i/total_files)*100) + "%" i += 1
# !/usr/bin/env python """ @Author Amit Joshi """ from pytesser import * from pdf2jpg import * for pdf in sys.argv[1:]: print("Processing PDFs...\n") pdf2jpg(pdf) jpgs = os.listdir("tmp") print("\nProcessing JPEGs...") print("Completed Count") count = 0 for jpg in jpgs: img = Image.open("tmp/" + jpg) txt = image_to_string(img) if not os.path.isdir("txt"): os.system("mkdir txt") f = open("txt/" + jpg.replace(".jpg", ".txt"), "w") f.write(txt) f.close() count += 1 print(str(count) + "\t"), os.system("rm tmp/" + jpg) print("\n\nDONE, see txt folder for results.")
# !/usr/bin/env python ''' @Author Amit Joshi ''' from pytesser import * from pdf2jpg import * for pdf in sys.argv[1:]: print('Processing PDFs...\n') pdf2jpg(pdf) jpgs = os.listdir('tmp') print('\nProcessing JPEGs...') print('Completed Count') count = 0 for jpg in jpgs: img = Image.open('tmp/' + jpg) txt = image_to_string(img) if not os.path.isdir('txt'): os.system('mkdir txt') f = open('txt/' + jpg.replace('.jpg', '.txt'), 'w') f.write(txt) f.close() count += 1 print(str(count) + '\t'), os.system('rm tmp/' + jpg) print("\n\nDONE, see txt folder for results.")