This script works on converting the text in a PDF into audio. It allows the text to be read out.
- PyPDF2 -- Used for basic operations on PDFs.
- pyttsx3 -- Used for text to speech conversion.
- The program opens the PDF whose path is entered in the code.
- PyPDF2 library performs operations on the PDF such as counting number of pages in the PDF and reading it.
- pyttsx3 library converts the text into audio format.
- A message 'Playing audio..' is displayed on the terminal.
- An audio starts reading the text.
- Get the content you want to be read in a PDF format.
- Write the correct location of the PDF inside the brackets of 'open()' in the code. For example, here I have used sample.pdf so in the code it should be 'infile = open('Related/sample.pdf', 'rb')'.
- Run the program.
- There are many recognized benefits of audiobooks that make them suitable for many situations.
- For instance, one can listen to audiobooks while driving, cleaning, walking, etc. and save a good amount of time.
- Many people love listening to audiobooks while multitasking.
This program helps the users to listen to PDFs rather than reading them and save time.