title: issue with symfony html2pdf not rendering pdf
body: <p>in my symfony project I am using Html2pdf library, and I have this code in my controller:</p>
  
  <pre><code>$html = $this-&gt;render('MyBundle:MyFolder:myPDF.html.twig', array('slug' =&gt; $slug));
  
  $html-&gt;getContent();
  
  try {
    $html2pdf = new \Html2Pdf_Html2Pdf('P', 'A4', 'fr', true, 'UTF-8');
    $html2pdf-&gt;pdf-&gt;SetAuthor('....');
    $html2pdf-&gt;pdf-&gt;SetDisplayMode('real');
    $html2pdf-&gt;writeHTML($html);
    $html2pdf-&gt;Output('Bill.pdf');
    $response = new Response();
  
    $response-&gt;headers-&gt;set('Content-type', 'application/pdf');
  
    return $response;
  
  } catch(HTML2PDF_exception $e) {
  
    die($e);
  }
  </code></pre>
  
  <p>No error occures here but it renders me this:</p>
  
  <p><a href="https://i.stack.imgur.com/iyIu1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iyIu1.png" alt="enter image description here"></a></p>
  
  <p>So, the controller not returns a correct pdf file.</p>
  
  <p>Why the html PDF render output like that ?</p>
  
  <p>This the view I would like to render in pdf:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="fr"&gt;
      &lt;head&gt;
          &lt;meta name="description" content="Bill"&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
        &lt;table&gt;
            &lt;thead&gt;
                &lt;tr&gt;
                    &lt;th&gt;test&lt;/th&gt;
                &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
                &lt;tr&gt;
                    &lt;td&gt;test&lt;/td&gt;
                &lt;/tr&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;/body&gt;
  </code></pre>
  
  <p>This the headers response return in my browser:</p>
  
  <blockquote>
  <pre><code>HTTP/1.1 500 Internal Server Error
  Date: Thu, 18 Feb 2016 13:05:16 GMT
  Server: Apache/2.4.9 (Win64) PHP/5.5.12
  x-powered-by: PHP/5.5.12
  Cache-Control: public, must-revalidate, max-age=0, no-cache
  Pragma: public
  Expires: Sat, 26 Jul 1997 05:00:00 GMT
  Last-Modified: Thu, 18 Feb 2016 13:05:17 GMT
  Content-Length: 2198
  Content-Disposition: inline; filename="Bill.pdf";
  X-Debug-Token: 5e207b
  X-Debug-Token-Link: /symfony/web/app_dev.php/_profiler/5e207b
  Connection: close
  Content-Type: text/html; charset=UTF-8
  </code></pre>
  </blockquote>
  
  <p>As you can see, the content type is not application/pdf too.</p>