PDF Story is a Python project that converts PDF text to speech and saves it as an MP3 file.
import pyttsx3
import PyPDF2
# Insert name of your PDF
pdfreader = PyPDF2.PdfFileReader(open('book.pdf', 'rb'))
speaker = pyttsx3.init()
for page_num in range(pdfreader.numPages):
text = pdfreader.getPage(page_num).extractText()
clean_text = text.strip().replace('\n', ' ')
print(clean_text)
# Name MP3 file whatever you would like
speaker.save_to_file(clean_text, 'story.mp3')
speaker.runAndWait()
speaker.stop()