Skip to content

Commit

Permalink
Fixed issues with incorrect pages getting converted
Browse files Browse the repository at this point in the history
  • Loading branch information
deadmantfa committed Feb 22, 2021
1 parent 6eff813 commit f75bc8d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@
def convert(pdf_document, start, end):
try:
text = ''
start -= 1
end -= 1
if start == end:
page_current = pdf_document.create_page(start)
for x in range(start - 1, end):
page_current = pdf_document.create_page(x)
text += page_current.text()
else:
for x in range(start, end):
page_current = pdf_document.create_page(x)
text += page_current.text()
# initialize tts, create mp3 and play
mp3_fp = io.BytesIO()
tts = gTTS(text=text, lang='en', slow=False, lang_check=False)
Expand Down

0 comments on commit f75bc8d

Please sign in to comment.