Last Updated : 23 Jul, 2025
Let us see how to read a PDF that is converting a textual PDF file into audio.
Packages Used:
Both these modules need to be installed
pip install pyttsx3
pip install PyPDF2
You also need to know about the open() function which will help us to open the PDF in read mode. Knowledge about the OOPS Concept is also recommended.
Approach:
Now here the code for it
Python
# importing the modules
import PyPDF2
import pyttsx3
# path of the PDF file
path = open('file.pdf', 'rb')
# creating a PdfFileReader object
pdfReader = PyPDF2.PdfFileReader(path)
# the page with which you want to start
# this will read the page of 25th page.
from_page = pdfReader.getPage(24)
# extracting the text from the PDF
text = from_page.extractText()
# reading the text
speak = pyttsx3.init()
speak.say(text)
speak.runAndWait()
Output:
Making Audio Book From Any PDF Using Python
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4