title: Unable to find "startxref" keyword opening PDF in PHP
body: <p>I am downloading a file, saving it locally and then opening it to get the number of pages in the file. I am getting an error: <code>Unable to find "startxref" keyword.</code> I have done searches and not found anything that could be connected to my problem.</p>
  
  <pre><code>public function getPageCountPDF($jobid) {
      $this-&gt;load-&gt;library('Awss3', null, 'S3');
      require_once 'application/libraries/fpdi/fpdf.php';
      require_once 'application/libraries/fpdi/fpdi.php';
      $PdfTranscriptInfo = $this-&gt;MJob-&gt;getDOCCSPdfTranscript($jobid);
      $filename = $PdfTranscriptInfo['origfilename'];
      $PdfFilename = 'uploads/' . $jobid . '/' . $filename;
      $pdfdata = $this-&gt;S3-&gt;readfile($PdfFilename, false, 'bucket');
      $localfilename = FCPATH . 'tmp/local.pdf'; 
      fopen($localfilename, 'a');
      $pdf = new FPDI();
      $pageCount = $pdf-&gt;setSourceFile($localfilename);  
      unlink($localfilename);
      return $pageCount;
  }
  </code></pre>
  
  <p>When I echo out the $pdfdata, I see the startxref keyword, so why is it not finding it?</p>
  
  <p>Anyone? Any ideas?</p>
  
  <p><strong>EDIT:</strong> I checked if the file is compressed and it is not.</p>
  
  <p><strong>SECOND EDIT:</strong> I see that my PDF is version 1.3, could that have anything to do with it?</p>