Skip to content

Commit acfc1d2

Browse files
authored
Added PDF to Audio Folder
PDF to Audio folder contains audio_book.py and pdf files
1 parent cad2873 commit acfc1d2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

PDF to Audio/audio_book.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pyttsx3
2+
import PyPDF2
3+
book = open('python_basics.pdf','rb')
4+
val = input("Enter the page no from where you want to start: ")
5+
val_converted = int(val)
6+
start_page = val_converted-1
7+
pdfReader = PyPDF2.PdfFileReader(book)
8+
page = pdfReader.numPages
9+
print(page)
10+
speaker = pyttsx3.init()
11+
for num in range(start_page,page):
12+
page = pdfReader.getPage(start_page)
13+
text = page.extractText()
14+
speaker.say(text)
15+
speaker.runAndWait()

PDF to Audio/python_basics.pdf

326 KB
Binary file not shown.

0 commit comments

Comments
 (0)