Build your own Free Audio Book from PDF using Python
Hello everyone,
In this tutorial, we are going to make an Audiobook from PDF using python. As we know we have to pay a lot of money to buy an audiobook subscription online, most of us cant able to afford that. so we can use this method to build an audiobook and listen to it.
we are using 2 dependencies to make it work. PyPDF2 and pyttsx3. The PyPDF2 dependencies help us to get the contents from the PDF file and the pyttsx3 will read that for us. simple.
let’s start writing code, for that You need Python and the PyCharm IDE on your pc (or you can use any of your IDE)
Download the dependencies first
pip install pypdf2
pip install pyttsx3
Now open your code editor and write this script. and copy your PDF file to the same folder as u have this file saved.
import PyPDF2 import pyttsx3 pdfobj = open('demo.pdf','rb') #replace demo with your file #pdf file object. pdfreader = PyPDF2.PdfFileReader(pdfobj) text = "" #read all the page of pdf. for pagenumber in range(pdfreader.numPages): page = pdfreader.getPage(pagenumber) #get page. text += page.extractText() #extract the text. pdfobj.close() #close the file. print(text) engine = pyttsx3.init() #init the text to speech library. engine.say(text) #this function speak the text. engine.runAndWait()
Run the code in your terminal. and this python guy will tell you what’s inside your book.
Enjoy your audio book.

Share with your friends:
Automate WhatsApp messages using python in 2 lines of code
Hello everyone, in this video we are going to make a WhatsApp automation script. so you can send WhatsApp msg […]
September 11, 2021
Build your own Free Audio Book from PDF using Python
Hello everyone, In this tutorial, we are going to make an Audiobook from PDF using python. As we know we […]
September 11, 2021
Download Instagram profile data with Python 3 Lines of code
Hello everyone, In this tutorial, we are going to download all the information including profile pics, posts, tags everything from […]
September 11, 2021
How to create Instagram Bot with InstaPy
Do you know how to create an Instagram bot with InstaPy. InstaPy is a python package, and we can use […]
March 31, 2021
Digital Marketing Toolkit
Get Free Access to Digital Marketing Toolkit. You can use all our tools without any limits
Get Free Access Now