From 3bfc077f53def08ee63da47a677a51ebf70ea7a9 Mon Sep 17 00:00:00 2001 From: inboxsgk <30730201+inboxsgk@users.noreply.github.com> Date: Sat, 25 Jul 2020 08:11:02 +0530 Subject: [PATCH] Fixed extractText()-Not returning text with spaces 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" --- PyPDF2/pdf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index c5cae9e67..bebe903c3 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -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