title: Convert HTML output of a PHP script to PDF?
body: <p>I have two files located in <code>localhost/invoice</code> named <code>x.php</code> and <code>template.php</code>,
  and then I have a URL like this:</p>
  
  <blockquote>
    <p>localhost/invoice/template.php?name=wawan</p>
  </blockquote>
  
  <p>How can I convert the output page into a PDF? What I want is to access <code>x.php</code> and then get the converted <code>template.php</code>. I tried using mpdf, but it doesn't work.</p>
  
  <p>Here's <code>x.php</code>:</p>
  
  <pre><code>&lt;?php
  include("MPDF54/mpdf.php");
  
  $mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); 
  
  $mpdf-&gt;SetDisplayMode('fullpage');
  
  $mpdf-&gt;list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
  
  $mpdf-&gt;WriteHTML(file_get_contents('template.php?name=wawan'));
  
  $mpdf-&gt;Output();
  ?&gt;
  </code></pre>
  
  <p>And this is <code>template.php</code>:</p>
  
  <pre><code>&lt;div&gt; The name is :
  &lt;?php
  
  
  echo $_GET[name];
  
  ?&gt;
  </code></pre>