Created
January 14, 2020 13:48
-
-
Save mrm8488/f166cfc79013474c5dcdd64fbaec41b9 to your computer and use it in GitHub Desktop.
Convert PDF file to text and then to audio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pdftotext | |
| from gtts import gTTS | |
| from sys import argv | |
| with open(argv[1], "rb") as f: | |
| pdf = pdftotext.PDF(f) | |
| document= "\n\n".join(pdf) | |
| tts = gTTS(document) | |
| print("Saving Audio file") | |
| tts.save(argv[1]+".mp3") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: