This Python Automation Script will read PDF's out loud.
Check whether you are running latest package manager pip
pip install --upgrade pip
Use the package manager to install pyttsx3.
pip install pyttsx3
Similarly install PyPDF2.
pip install PyPDF2
Import installed libraries
import pyttsx3 # Python Text to Speech Version 3
import PyPDF2 # Python PDF Reader/Writer 2
Copy & Paste your desired PDF in project folder.
Open the book you want to listen
book = open('pdf_name.pdf', 'rb') # Opens pdf in book (replace pdf_name.pdf with you pdf name)
Pre-work such as reading total number of pages from the book
pdfReader = PyPDF2.PdfFileReader(book) # Reads book
pages = pdfReader.numPages # Calculates total number of pages from book
print(pages) # prints total number of pages
Initialize Python Text to Speech
bot = pyttsx3.init()
for num in range(0, pages): # from first page (0) to calculated last page
page = pdfReader.getPage(0)
# to skip index and pdf clutter replace 0 with your desired page number - 1
text = page.extractText()
bot.say(text)
bot.runAndWait()