title: Why is $pageCount coming back as 0? (Finding the number of pages in a PDF using FPDI)
body: <p>After much research and trial and error, I have written a function to get the number of pages in a PDF using FPDI. The problem is that it returns 0.</p>
  
  <pre><code>function testPageCount() {
      $filename = 'uploads/229576/name.pdf';
      $pageCount = 0;
      if (file_exists($filename)) {
          require_once 'application/libraries/fpdi/fpdf.php';
          require_once 'application/libraries/fpdi/fpdi.php';
          $pdf = new FPDI();
          $pageCount = $pdf-&gt;setSourceFile($filename);
      }
      echo $pageCount;
  }
  </code></pre>
  
  <p>According to several examples I've seen on SO and other places, this is the way to do it, but it's not working. (The answer should be 7.)  Can anyone tell me what I'm doing wrong? I think that it only works for files under 100 KB, which is useless to me. Does anyone know if this is true, and if so, how to get around it? (I'm not getting any error messages and files greater than 100 KB are not showing anything.)</p>
  
  <p>EDIT: It seems as though this only works for local files, not files on a server. Does anyone know a way around this?</p>