title: Create PDF with DOMPDF and Redirect
body: <p>In a PHP project I need to Create a PDF file and redirect to another page when user clicks a Submit button.
  I have managed to create the pdf file using <a href="http://code.google.com/p/dompdf/" rel="nofollow">DOMPDF</a>. PDF creation is done in a seperate file <code>('PDFRecipt.php')</code>.
  I have called that page when a user clicks a button on the main page. This is how  call PDF page</p>
  
  <pre><code>header('location:PDFRecipt.php');
  </code></pre>
  
  <p>but the problem is when I try  to redirect after calling PDF page by</p>
  
  <pre><code>header('location:Other.php');
  </code></pre>
  
  <p>It does not create the PDF (only redirects). I tried changing 
  <code>header('location:PDFRecipt.php');</code>
  to 
  <code>include_once('PDFRecipt.php');</code></p>
  
  <p>then it does not create the PDF correctly (Corrupted PDF File)</p>
  
  <p>How to create the PDF file &amp; redirect to other page?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Code in <code>PDFRecipt.php</code></p>
  
  <pre><code>$html='SOME HTML';
  include("../../dompdf/dompdf_config.inc.php");
  $dompdf = new DOMPDF();
  $dompdf-&gt;load_html($html);
  $dompdf-&gt;render();
  $dompdf-&gt;stream('FileName.pdf');        
  //header('location:Other.php);
  </code></pre>