How encode in base64 a file generated with jspdf and html2canvas?
<p>i'm trying encode the document generated in the attached code, but nothing happens, not generate  error but neither encodes the file, and the <code>ajax</code> <code>request</code> is never executed</p>

<p>what is the correct way?</p>

<pre><code>    html2canvas(document.getElementById("workAreaModel"), {
    onrendered: function(canvas)
    {
        var img = canvas.toDataURL("image/png");
        var doc = new jsPDF("l", "pt", "letter");
        doc.addImage(img, 'JPEG',20,20);
        var fileEncode = btoa(doc.output());
         $.ajax({
              url: '/model/send',
              data: fileEncode,
              dataType: 'text',
              processData: false,
              contentType: false,
              type: 'GET',
              success: function (response) {
                   alter('Exit to send request');
              },
              error: function (jqXHR) {
                  alter('Failure to send request');
              }
             });
    }
});
</code></pre>