title: PHP: Adobe Reader can't open PDF files created with fpdf
body: <p>I have generated pdf file using fpdf but i'm getting the error.
  Adobe reader could not open the 'invoice.pdf' because it is either not a supported file type or because the file has been damaged. Any help would be greatly appreciated!</p>
  
  <pre><code>&lt;?php 
  $f_name=$_POST['first-name'];
  
  if(isset($_POST['submit']))
  {   
  $f_name=$_POST['name'];
  $l_name=$_POST['last-name'];
  $email=$_POST['email'];
  
  require("fpdf/fpdf.php");
  $fpdf=new FPDF();
  $fpdf-&gt;AddPage();
  $fpdf-&gt;setFont("Arial","B",16);
  $fpdf-&gt;Cell(0,10,"Invoice",1,1,"C");
  $fpdf-&gt;Cell(95,10,"Name:",1,0,"C");
  $fpdf-&gt;Cell(95,10,$f_name,1,1,"C");
  $fpdf-&gt;Cell(95,10,"Last Name:",1,0,"C");
  $fpdf-&gt;Cell(95,10,$l_name,1,1,"C");
  $fpdf-&gt;Cell(95,10,"Email:",1,0,"C");
  $fpdf-&gt;Cell(95,10,$email,1,1,"C");
  
  $file_location = $_SERVER['DOCUMENT_ROOT']."/invoice/up_pdfs/".$f_name.".pdf";
   file_put_contents($file_location,$fpdf); 
  
  ob_clean(); 
  
  $fpdf-&gt;output();
   header("Location: index.php");
   }
   ?&gt;
  </code></pre>