Skip to main content

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) pages = pdf_reader.numPages play = pyttsx3.init() print('playing....') for num in range(0,pages): page = pdf_reader.getPage(num) text = page.extractText() play.say(text) play.runAndWait()




Comments

Popular posts from this blog

Facebook launches digital assistant ‘M’ in the US

Facebook today launched its digital assistant named “M” for US users of its Messenger application, ramping up the social network’s efforts in artificial intelligence. For users of the messaging platform, M will pop up and suggest “helpful actions” in the chat window. The move is seen as the first step in a broader launch of the digital assistant to compete against services from google,Amazon, microsoft,samsung,which is launching its new assistant with its newest smartphone. M uses artificial intelligence and “suggests relevant actions to help manage conversations or help get things done,” Facebook product managers Laurent Landowski and Kemal El Moujahid said in a blog post. “We are bringing the power of M’s AI technology to support and enhance the Messenger experience and make it more useful, personal and seamless.” With M, Facebook Messenger users can simplify tasks such as sending money to friends, sharing location or obtaining a ride-share. Facebook, which has i...

What is ARP Monitor?

ARP MONITOR It’s FREE  tool like arpwatch but for Windows OS. This tool can help with ARP activity monitoring in computer networks.   It allows you to catch intruders on the network, track MAC-IP bundles, detect scans, monitor real-time ARP protocol activity in the segment, and much more. This windows software monitors ethernet activity like unix apwatch and keeps a database of ethernet/ip address pairings. new activity - This ethernet/ip address pair has been used for the first time. new station - The ethernet address has not been seen before. flip flop - The ethernet address has changed from the most recently seen address to the second most recently seen address. changed ethernet address - The host switched to a new ethernet address.  Download :   Mirror: http://www.binaryplant.com/binaryplant-arp-monitor.exe