-
-
Save amankharwal/41082a4e10d02c408679f2c9ba0a466a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyttsx3 | |
import pdfplumber | |
import PyPDF2 | |
file = 'C:/Users/<user_name>/Desktop/Book.pdf' | |
#Creating a PDF File Object | |
pdfFileObj = open(file, 'rb') | |
# creating a pdf reader object | |
pdfReader = PyPDF2.PdfFileReader(pdfFileObj) | |
#Get the number of pages | |
pages = pdfReader.numPages | |
with pdfplumber.open(file) as pdf: | |
#Loop through the number of pages | |
for i in range(0, pages): | |
page = pdf.pages[i] | |
text = page.extract_text() | |
print(text) | |
speaker = pyttsx3.init() | |
speaker.say(text) | |
speaker.runAndWait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment