title: Emailing PDF generated with CakePDF
body: <p>I'm using CakePHP 2, CakeEmail and the CakePDF plugin </p>
  
  <p>I'm trying to generate a PDF based on a view and attach it to an email. I've read the read me file but am still none the wiser. Do I have to actually create the file on the server?</p>
  
  <p>This is my code so far (email gets sent but no PDF).</p>
  
  <pre><code>// Build PDF as attachment
          $CakePdf = new CakePdf();
          $CakePdf-&gt;template('email_view', 'default');
          //get the pdf string returned
          $pdf = $CakePdf-&gt;output();
  
          // SMTP Options
          $this-&gt;Email-&gt;smtpOptions = array(
  
              // Only to be used internally
              'port'=&gt;'25',
              'timeout'=&gt;'30',
              'host' =&gt; '111.111.111.111',
              'username'=&gt;'',
              'password'=&gt;''
           );
          $this-&gt;Email-&gt;template = 'newExpenseClaim';
          $this-&gt;Email-&gt;from    = 'Expense Tracker &lt;james@test.com&gt;';
          $this-&gt;Email-&gt;to      = 'james@test.com'; 
          $this-&gt;Email-&gt;subject = 'New Expense Claim Submitted - Please Review';
          $this-&gt;Email-&gt;sendAs = 'both';
          $this-&gt;Email-&gt;delivery = 'smtp';
  
          $this-&gt;Email-&gt;attachments = $pdf;
  
          // Set username &amp; url in email
          $this-&gt;set('user', $fu['User']['name']);
          $this-&gt;set('ms', $ms);
          $this-&gt;Email-&gt;send();
          $this-&gt;set('smtp_errors', $this-&gt;Email-&gt;smtpError);
  </code></pre>
  
  <p>Here is the read me from github:</p>
  
  <p><a href="https://github.com/ceeram/CakePdf" rel="nofollow">https://github.com/ceeram/CakePdf</a></p>
  
  <p>Any help would be gratefully received!</p>