title: Xref error while parsing PDF using PyPDF2 and pdfrw?
body: <p>I am trying to extract the text from the following <a href="https://github.com/mstamy2/PyPDF2/files/4292903/1.pdf" rel="nofollow noreferrer">PDF</a>. </p>
  
  <p>First, I used the <code>PyPDF2</code> library. I used the following code: </p>
  
  <pre class="lang-py prettyprint-override"><code>from PyPDF2 import PdfFileReader
  pdf = PdfFileReader('March_5_8000/1.pdf',strict=False)
  information = pdf.getDocumentInfo()
  </code></pre>
  
  <p>This throws the following error: </p>
  
  <pre class="lang-py prettyprint-override"><code>/opt/conda/envs/fastai/lib/python3.6/site-packages/PyPDF2/pdf.py in getObject(self, indirectReference)
     1597             if debug: print(("  Uncompressed Object", indirectReference.idnum, indirectReference.generation, ":", start))
     1598             self.stream.seek(start, 0)
  -&gt; 1599             idnum, generation = self.readObjectHeader(self.stream)
     1600             if idnum != indirectReference.idnum and self.xrefIndex:
     1601                 # Xref table probably had bad indexes due to not being zero-indexed
  
  /opt/conda/envs/fastai/lib/python3.6/site-packages/PyPDF2/pdf.py in readObjectHeader(self, stream)
     1665             warnings.warn("Superfluous whitespace found in object header %s %s" % \
     1666                           (idnum, generation), utils.PdfReadWarning)
  -&gt; 1667         return int(idnum), int(generation)
     1668 
     1669     def cacheGetIndirectObject(self, generation, idnum):
  
  ValueError: invalid literal for int() with base 10: b'obj'
  </code></pre>
  
  <p>I also tried using the <code>pdfrw</code> library, but that returned the same error: 
  Code: </p>
  
  <pre class="lang-py prettyprint-override"><code>from pdfrw import PdfReader
  x = PdfReader('March_5_8000/980.pdf')
  x.keys()
  </code></pre>
  
  <p>ERROR: </p>
  
  <pre class="lang-py prettyprint-override"><code>PdfParseError                             Traceback (most recent call last)
  &lt;ipython-input-6-6d3575671b6c&gt; in &lt;module&gt;
        1 from pdfrw import PdfReader
  ----&gt; 2 x = PdfReader('March_5_8000/980.pdf')
        3 x.keys()
  
  /opt/conda/envs/fastai/lib/python3.6/site-packages/pdfrw/pdfreader.py in __init__(self, fname, fdata, decompress, decrypt, password, disable_gc, verbose)
      617             while 1:
      618                 source.obj_offsets = {}
  --&gt; 619                 trailer, is_stream = self.parsexref(source)
      620                 prev = trailer.Prev
      621                 if prev is None:
  
  /opt/conda/envs/fastai/lib/python3.6/site-packages/pdfrw/pdfreader.py in parsexref(self, source)
      463             return self.readdict(source), False
      464         else:
  --&gt; 465             source.exception('Expected "xref" keyword or xref stream object')
      466 
      467     def readpages(self, node):
  
  /opt/conda/envs/fastai/lib/python3.6/site-packages/pdfrw/tokens.py in exception(self, *arg)
      227 
      228     def exception(self, *arg):
  --&gt; 229         raise PdfParseError(self.msg(*arg))
  
  PdfParseError: Expected "xref" keyword or xref stream object (line=2238, col=39, token='obj')
  </code></pre>
  
  <p>How can I solve this? </p>