title: PyPDF2.extractText( ) extracts text but tokenizes strings when pdfs contain watermark
body: <p>I am using PyPDF2 to read multiple files and extract the page number that contain specific text. For the most part it works fine but I notice that some files with watermark can't read properly. They can't return page numbers even though they meet the criteria, because the PY2PDF extractText() method tokenizes the strings instead of keeping them as they are in the pdf. For example, I am looking for string &quot; tax return 1065&quot; in the pdf and the extract text () returns &quot;tax&quot; &quot;return&quot; &quot;1065&quot;, therefore it's considered unmatched and won't return the page number. My code is:</p>
  <pre><code>object = PyPDF2.PdfFileReader(filepath)
  NumPages = object.getNumPages()
  String = 'tax return 1065'
  Pagelist=[]
  for i in range(0,NumPages):
      PageObj=object.getPage(i)
      Text = PageObj.extractText()
      ReSearch = re.search(String,Text)
      if ReSearch != None:
          Pagelist.append(i)
  print(Pagelist)
  
  </code></pre>
  <p>it returns an empty list even though the pdf has a few pages that contain the string &quot;tax return 1065&quot;, so I use print(Text) to see the extracted text and notice that all the words are tokenized onto separate lines:</p>
  <ul>
  <li>dear</li>
  <li>client</li>
  <li>please</li>
  <li>review</li>
  <li>your</li>
  <li>tax</li>
  <li>return</li>
  <li>1065</li>
  </ul>
  <p>it only runs into the above issue when the pdf has watermark. Does anyone have a solution for it? Thank you!</p>