
All we need to do is pass the string we made, store the output in a variable, then use the save() method to output the file to the computer. Now we are ready to use the gTTS (google Text To Speech) library. Now we have it all as one piece of string. So lets loop through this array and add them all to one string. mp3 file, We will have to make sure they are all stored as one string. If you print this variable, you will get an array of strings. Now we have the file stored in the variable pdf.

To do that we will use a library called pdftotext. But we also want to convert the pdf file into regular pieces of text. Now we have the file location stored in a filelocation variable.Īs I said before, to open a file in Python we just need to use the open() method. So to make it easier we will use tkinter library to open up an interface that lets us choose the file.

For this I need to use the method open("filelocation", "rb") to open the file in reading mode.
