title: Generate PDF with jsPDF and attach it with the Mandrill API
body: <p>I'm trying to attach a generated PDF with jsPDF to a Mandrill email. The code is as follows:</p>
  
  <pre><code>  doc.addHTML($('#pdfTarget').get(0), function() {
    var pdfOutput = doc.output();
  
    $.ajax({
      type: 'POST',
      url: 'https://mandrillapp.com/api/1.0/messages/send.json',
      data: {
          'key': 'my_key',
          'message': {
          'from_email': 'recipient@gmail.com',
          'to': [
              {
              'email': 'email@gmail.com',
              'name': 'Test',
              'type': 'to'
              }
          ],
          'autotext': 'true',
          'subject': 'Here is your PDF',
          'html': 'This is your PDF!',
          "attachments": [
              {
              "type": "application/pdf;base64",
              "name": "your_pdf.pdf",
              "content": Base64.encode(pdfOutput)
          }
          ]
      }
    }
    }).done(function(response) {
      console.log(response); // if you're into that sorta thing
    });
    });
  </code></pre>
  
  <p>If I run doc.save() the generated PDF is downloaded and saved properly. But if I use doc.output() and use the result as an email attachment the file will be corrupted. If I Base64 encode the output like in the example the attached PDF won't be corrupted, but show up blank. I've tinkered back and forth by Base64 encoding, attaching as an  in the actual e-mail HTML and so forth - but nothing works.</p>
  
  <p>I've also tried attaching the PDF as a blob, but that fails as well as the file will be corrupted.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>