python-scripts/scripts/PDF to Voice/app.py
2022-10-03 23:05:57 +05:30

10 lines
264 B
Python

import PyPDF2
import pyttsx3
path = open('daily-python-scripts\scripts\PDF to Voice\sample.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(path)
from_page = pdfReader.getPage(0)
text = from_page.extractText()
speak = pyttsx3.init()
speak.say(text)
speak.runAndWait()