Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 707230e

Browse files
authored
Merge pull request #280 from simarpreetsingh-019/master
Story reader using python
2 parents 89d9056 + b9b883d commit 707230e

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com)
2+
3+
<div align="center">
4+
<img src="audiobook.png" height=500 width="500">
5+
</div>
6+
7+
# Audiobook
8+
9+
Read any audio book from pdf using python.
10+
11+
### Modules used:
12+
1. PyPDF2
13+
2. Pyttsx3
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from time import sleep
2+
3+
import pyttsx3 #pip install pyttsx3
4+
import PyPDF2 #pip install PyPDF2
5+
6+
story = open('mybook.pdf', 'rb') #Name of your script make sure it's in pdf format
7+
pdfReader = PyPDF2.PdfFileReader(story)
8+
pages = pdfReader.numPages
9+
# pages = pdfReader.getPage(number) Replace nu,ber with any specific page number you want this to read
10+
engine = pyttsx3.init()
11+
voices = engine.getProperty('voices')
12+
engine.setProperty('voice', voices[0].id) #For male voice change the value to 1.
13+
14+
for num in range(0, pages):
15+
page = pdfReader.getPage(num)
16+
text = page.extractText()
17+
engine.say(text)
18+
engine.runAndWait()
Binary file not shown.

0 commit comments

Comments
 (0)