title: symfony2 - output pdf page
body: <p>I'm trying to create an action which will return a pdf (HTML to PDF).</p>
  
  <p>I have a button in my twig file which calls in AJAX a routing pattern which will call the next controller action:</p>
  
  <pre><code>public function pageToPDFAction(){
      $html = file_get_contents("http://www.google.com");      
      $headers = array(
          'Content-type' =&gt; 'application/pdf'
      );
      $response = new Response($html,200,$headers);
      return $response;
  }
  </code></pre>
  
  <p>The output I'm getting is in fact the google.com website, but what I want to get is the browser opening a pdf file like it happens when you click on a pdf file.</p>
  
  <p>How can I achieve that? what am I missing?</p>