Skip to main content

Create your own Audiobook using python| Ebook| PDF reader using python| python for beginner

 Hello reader's

In this post you are going to see that "How you can create your own audiobook or Ebook" or simply a pdf reader using python. For doing this you must have basic knowledge of python. 




First of all install python on your laptop or desktop or what ever machine you are using, to download python click here.

If you don't know how to install python then you can checkout my other post's in which i have explained how to install python and any IDE which supports python. After the successful installation of python install a IDE which supports python or you can use Python's IDE too. 

There is also a different IDE's which support's python, like - VS Code, Pycharm are well known for python development. 

After the successful installation of python and it's supportive IDE lets get into the code , now you have to install some modules to run the code, Modules are nothing but some files with the “. py” extension containing Python code that can be imported inside another Python Program. In simple terms, we can consider a module to be the same as a code library or a file that contains a set of functions that you want to include in your application. 

now lets install the modules, Open your command prompt and type "pip install pyttsx3" pyttsx3 is a is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3. 



installing pyttsx3 using pip in cmd


As you can see in the above picture, i have already installed that's why it is showing me that requirement already satisfied but in your case it will install. 

After the successful installation of pyttsx3 , you have to install one more module named PyPDF2. To install PyPDF2 type "pip install pypdf2" in command prompt. 



installing Pypdf2 using pip in cmd


After the successful installation of code , let's start with code , Open your favourite IDE and type code .

First import all the two modules which you have installed using pip command. so type "import pyttsx3 import PyPDF2"  this lines going to import import the modules. 
now type , "book = open('Filename.pdf', 'rb')"  This line going to fetch the pdf file which you have stored at some location in storage. 
"pdfReader = PyPDF2.PdfFileReader(book)" This line is going to initialize the PyPDF2 module. 
If you want to know that how many pages are there in that perticular file the type "pages = pdfReader.numPages" This line of code is going to tell you that how many number of pages are there in that pdf file. 
Now you have initialize the speaker to speak up or to read the pdf , for initializing the speaker type "speaker = pyttsx3.init()" . 

"for num in range(1, pages):
    page = pdfReader.getPage(num)"  This two lines of code is going tell you that there are how many number of pages are there in pdf. 

"text = page.extractText()
    speaker.say(text)"
 This two lines of code is going to extract text from pdf, mainly these two lines of code are going to read out the pdf. 

   " speaker.runAndWait()"  This function will make the speech audible in the system, if you don't write this command then the speech will not be audible to you.







Code :- 
import pyttsx3
import PyPDF2
book = open('The Django Book ( PDFDrive ).pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(book)

pages = pdfReader.numPages
speaker = pyttsx3.init()
for num in range(1, pages):
    page = pdfReader.getPage(num)
    text = page.extractText()
    speaker.say(text)
    speaker.runAndWait()

Comments

Post a Comment

Thank you for sharing this.

You’re helping us become better. Want to stay in the loop? Subscribe to our YouTube channel.

Popular posts from this blog

Cafe management software| Restaurant management system| Inventory management for cafes| Cafe billing system

 Cafes have become a popular spot for people to hang out, have meetings or just grab a quick bite. With the increasing number of cafes in cities, managing them efficiently has become a crucial task. This is where a cafe management system comes into play. In this blog post, we will discuss what a cafe management system is, its features and benefits. A cafe management system is a software that helps cafe owners to manage various aspects of their cafe, such as billing, inventory, customer management, employee management and sales tracking. The system automates most of the mundane tasks, freeing up the owner's time to focus on more important aspects of running the cafe. Features of a Cafe Management System: Billing: The cafe management system should have a billing feature that allows the cafe owner to create bills quickly and accurately. It should also have the capability to generate invoices and receipts. Inventory Management: The system should be able to manage the cafe's invento...

DALL-E AI, AI-generated images, GPT-3, OpenAI, artificial intelligence, natural language processing, deep learning, neural networks, image synthesis, image recognition, visual content creation.

 DALL.E is an AI system that can create images from text descriptions, using a large neural network trained on a dataset of text-image pairs. It was introduced by OpenAI in January 2021, and has since been improved with DALL.E 2, which generates more realistic and accurate images with higher resolution. In this blog post, I will explain how DALL.E works and show some examples of its amazing capabilities. DALL.E is based on GPT-3, a transformer language model that can generate text for a wide range of tasks. DALL.E extends GPT-3 by adding image tokens to its vocabulary, allowing it to generate both text and images in a single stream of data. DALL.E receives both the text and the image as input, and is trained to generate all of the tokens, one after another, using maximum likelihood. To represent images, DALL.E uses a discrete variational autoencoder (VAE) that compresses each image to a 32x32 grid of discrete latent codes. Each code corresponds to one of 8192 possible image tokens....

Automation and robotics| automation, robotics, artificial intelligence, machine learning, industrial revolution, manufacturing, productivity, efficiency, human-robot collaboration, automation technology, future of work, job displacement, innovation

 Automation and robotics are two technologies that have revolutionized the manufacturing industry. They have enabled manufacturers to produce goods more efficiently and with higher quality than ever before. Automation refers to the use of technology to perform tasks without human intervention, while robotics involves the use of machines to perform tasks that would otherwise require human labor. This blog post will discuss the history, benefits, and challenges of automation and robotics in the manufacturing industry. History of Automation and Robotics The history of automation and robotics can be traced back to the early 20th century when Henry Ford introduced the assembly line. The assembly line allowed workers to specialize in specific tasks and increased productivity. The introduction of programmable logic controllers (PLCs) in the 1970s further advanced automation by allowing machines to be controlled by computers. The first robots were developed in the 1950s and were primarily ...