text_plain_output_1.png
from pdf2image import convert_from_path,convert_from_bytes

import easyocr

PDF_file = '../input/osbook/operating-system-concepts-9th-edition.pdf'
'\nPart #1 : Converting PDF to images\n'
pages = convert_from_path(PDF_file, dpi=100, thread_count=4)
type(pages[0])

image_counter = 1
for page in pages:
    filename = 'page_' + str(image_counter) + '.jpg'
    page.save(filename, 'JPEG')
    image_counter = image_counter + 1

reader = easyocr.Reader(['en'])
filelimit = image_counter - 1
outfile = 'out_text.txt'
text = ''
f = open(outfile, 'a')
for i in range(1, image_counter - 1):
    filename = 'page_' + str(i) + '.jpg'
    result = reader.readtext(filename, paragraph='True')
    for i in result:
        text = text + '\n' + i[1]

PDF_file = '../input/osbook/2011_EST_OS.pdf'
image_counter = 1
pages = convert_from_path(PDF_file, dpi=150, thread_count=4, last_page=200)
fileAll = []
for page in pages:
    filename = 'page_' + str(image_counter) + '.jpg'
    page.save(filename, 'JPEG')
    image_counter = image_counter + 1
    fileAll.append(filename)

reader = easyocr.Reader(['en'])
a = reader.readtext_batched(fileAll[:100], paragraph='True')

for i in a:
    print()
    for j in i:
        print(j)