title: Render view to variable in CakePHP 1.3 (to generate pdf and download file)
body: <p>I'm trying to render a view to a variable.
  This variable will then be used to generate a pdf.
  Then that pdf should be downloaded with the Media view.</p>
  
  <p>Here's my controller code:</p>
  
  <pre><code>
  
          $dir = ROOT . '/app/tmp/evaluationpdf/';
          $path = $dir . $evaluationid . '.pdf';
  
          $evaluation = $this->SelfEvaluation->find('first', array(
              'conditions' => array('SelfEvaluation.id' => $evaluationid),
              'contain' => array('Submission' => array('Application'), 'Applicant', 'Member')));
  
          $this->set(compact('evaluation'));
          $this->output = '';
          $this->layout = false;
          $html = $this->render('/elements/self_evaluation_pdf');
  
          $this->_generate_pdf($html, $path);
  
          $this->view = 'Media';
  
          $params = array(
                  'id' => $evaluationid . '.pdf',
                  'name' => $evaluationid,
                  'download' => true,
                  'extension' => 'pdf',
                  'path' => $dir,
          );
  
          $this->set($params);
  
  </code></pre>
  
  <p>The file is created as it should, but the first '$this->render' output is also sent to the browser.</p>
  
  <p>The file is never downloaded.</p>
  
  <p>Any idea on how to fix this?</p>