title: Symfony2 does not redirect to a new page after pdf generation with tcpdf
body: <p>I have a controller which should generate pdf file and after that should redirect to another site.</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>class DocuController extends Controller
  {
      public function indexAction() {
            // some other code
              if ($request-&gt;get('_add_document'))
              {
                  $form-&gt;bindRequest($request);
                  $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
                  $em-&gt;persist($document);      
                  $em-&gt;flush();   
                  if ($session-&gt;get('journey_id')!=false)
                  {
                      $relation = new DocumentJourneyInJourney();
                      $relation-&gt;setJourney($session-&gt;get('journey_id'));
                      $relation-&gt;setDocument($document-&gt;getId());
                      $em-&gt;persist($relation);
                      $em-&gt;flush();
                  }
                  $pdf=$this-&gt;generatePDF($form);   
                  $pdf-&gt;Output('file.pdf', 'I');
  
                  return $this-&gt;redirect($this-&gt;generateUrl('another_site'));
              }
      }        
      return $this-&gt;render('Bundle:Page:document.html.twig'); 
  }
  
  public function generatePDF($form)
  {
      $pdf = $this-&gt;get("wrep.tcpdf")-&gt;create();
      $pdf-&gt;SetTitle('Tittle');        
      $pdf-&gt;SetHeaderData('', 0, '  ', '  ', array(0,0,0), array(0,0,0)); 
      $pdf-&gt;setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
      $pdf-&gt;SetPrintFooter(false);  
      $pdf-&gt;SetAutoPageBreak(TRUE);         
      $pdf-&gt;AddPage();
      $html = $this-&gt;renderView('Bundle:document.twig',
                      array(
                      'traveller' =&gt; $form["name"]-&gt;getData().' '.$form["surname"]-&gt;getData(),
                      'document' =&gt; $form["full_name"]-&gt;getData()
                      )
                  );  
      $pdf-&gt;writeHTML($html, $ln=false, $fill=false, $reseth=false, $cell=false, $align='');
      return $pdf;
  }
  }
  </code></pre>
  
  <p>But with this code the pdf is generated and browser downloading it but the page is not redirected. </p>