Skip to main content

Posts

Showing posts from January, 2021

Create your own Audiobook from any PDF using Python

  Are you bored of reading pdfs, soft copies, books? Then here's a solution, you can convert it into an Audiobook and Listen. Let's get Started First, we need to install the necessary libraries. We require two libraries to build Audiobooks using Python. 1. PyPDF2 A Pure-Python library built as a PDF toolkit. It is capable of extracting document information splitting documents page by page merging documents page by page cropping pages merging multiple pages into a single page encrypting and decrypting PDF files and more! So open your terminal and run the following command.  pip install PyPDF2 2. Pyttsx3 pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline and is compatible with both Python 2 and 3. So open your terminal and run the following command. pip install pyttsx3 Now here the code for it. import pyttsx3 import PyPDF2 book_name = open('harrypotter.pdf','rb') pdf_reader = PyPDF2.PdfFileReader(book_name) pa...