title: Chrome has "Failed to load PDF document" error message on inline PDFs
body: <p>I have a problem with reading pdf file in Chrome by using PHP.</p>
  
  <p>The following code is how I do in PHP</p>
  
  <pre><code>$path = "actually file path";
  header("Pragma: public");
  header("Expires: 0");
  header("Content-type: $content_type");
  header('Cache-Control: private', FALSE);
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  header("Content-Disposition: inline; filename=\"$filename\"");
  header('Content-Transfer-Encoding: binary');
  header('Content-Length' . filesize($path));
  ob_clean();
  flush();
  readfile($path);
  </code></pre>
  
  <p>In here, I set the Content-Disposition to inline. Because I want to display the pdf file if user browser have build-in pdf viewer plugin. As you may know, Chrome has build-in pdf viewer. </p>
  
  <p>The problem is I have bunch of pdf files on the server. Only some of them can be viewed by Chrome. I can't figure out why others can not work the same way. I have checked the permission of each files. It looks like not the permission problem. </p>
  
  <p>Is there anyone know what the problem is? Thank you.</p>