Skip to content

Commit

Permalink
BUG: Add whitespace between words for extractText() (#569)
Browse files Browse the repository at this point in the history
Previously the function .extractText() reads the text in the PDF and returns without any spaces.
In this fix the pdf.py file has been modified to add " " (space) in between two words

Here is an example below:-
Original Sentence : "The quick brown fox jumps over the lazy dog"

Previous Output : "Thequickbrownfoxjumpsoverthelazydog"

After the fix : "The quick brown fox jumps over the lazy dog"
  • Loading branch information
inboxsgk committed Apr 6, 2022
1 parent b17db79 commit 02cc54b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions PyPDF2/pdf.py
Expand Up @@ -2683,6 +2683,7 @@ def extractText(self):
elif operator == b_("TJ"):
for i in operands[0]:
if isinstance(i, TextStringObject):
text += " "
text += i
text += "\n"
return text
Expand Down

0 comments on commit 02cc54b

Please sign in to comment.