From 5c61de5fd7b7c9fe1da2679d2c89ce085673f8c4 Mon Sep 17 00:00:00 2001 From: Ronaldo89 <71316604+Ronaldo89@users.noreply.github.com> Date: Mon, 31 Oct 2022 19:55:42 +0200 Subject: [PATCH] Create PDFtoAudio.py converting your pdf file to audio --- Python/PDFtoAudio.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Python/PDFtoAudio.py diff --git a/Python/PDFtoAudio.py b/Python/PDFtoAudio.py new file mode 100644 index 0000000..77c3b3e --- /dev/null +++ b/Python/PDFtoAudio.py @@ -0,0 +1,16 @@ +#Import the required packages +!pip install pyttsx3 +!pip install PyPDF2 +import pyttsx3 +import PyPDF2 + +file = open("sample.pdf", mode= "rb") +pdf_reader = PyPDF2.PdfFileReader(file) +pages - pdf_reader.getPage(1) +#page no which you want to convert into audio + +text = pages.extractText() + +melo = pyttsx3.init() +melo.say(text) +melo.runAndWait()