title: Problems With Forcing Download of a PDF File
body: <p>I have the following function to force download a file:</p>
  
  <pre><code>static public function download($file, $options=array()) {
      $content = (isset($options['content'])) ? $options['content'] : '';
      $contentType = (isset($options['contentType'])) ? $options['contentType'] : '';
      header('Cache-Control: public');
      header('Content-Description: File Transfer');
      header('Content-Disposition: attachment; filename='.File::filename($file));
      header('Content-Type: '.$contentType);
      header('Content-Transfer-Encoding: binary');
      if ($content!='') {
          echo $content;
      } else {
          readfile($file);
      }
  }
  </code></pre>
  
  <p>i send a PDF file and contentType = "application/pdf".
  the problem is that when i try to open the downloaded PDF file it says "There was an error opening this document. The file may be corrupt".
  Is weird because i can open the original file and they look exactly the same (filename, size, etc)</p>