title: Convert pdf files to raw text in new directory
body: <p><strong>Here is what I'm trying:</strong></p>
  
  <pre><code>import PyPDF2
  from PyPDF2 import PdfFileWriter, PdfFileReader
  
  import re
  import config
  import sys
  import os
  
  with open(config.ENCRYPTED_FILE_PATH, mode='rb') as f:
          reader = PyPDF2.PdfFileReader(f)
          if reader.isEncrypted:
              reader.decrypt('Password123')
              print(f"Number of page: {reader.getNumPages()}")
  
              for i in range(reader.numPages):
                  output = PdfFileWriter()
                  output.addPage(reader.getPage(i))                
                  with open("./pdfs/document-page%s.pdf" % i, "wb") as outputStream:
                      output.write(outputStream)
                      print(outputStream)
  
                      for page in output.pages: # failing here
                          print page.extractText() # failing here
  </code></pre>
  
  <p>The entire program is decrypting a large pdf file from one location, and splitting into a separate pdf file per page in new directory -- this is working fine. <strong>However, after this I would like to convert each page to a raw <code>.txt</code> file in a new directory. <em>i.e.</em> <code>/txt_versions/</code></strong> <em>(for which I'll use later)</em></p>
  
  <p><em>Ideally, I can use my current imports, i.e. PyPDF2 without importing/installing more modules/. Any thoughts?</em></p>