title: Problems downloading base64 as pdf JavaScript
body: <p>I'm writing a Google Apps Script Web App, I'm facing a problem.</p>
  <p>From server side I return the base64 encoded html code of a page:</p>
  <pre><code>function getRAW() { 
    var formText = 'https://www.google.com/';
    var response = UrlFetchApp.fetch(formText);
    var pdf1 = response.getAs('application/pdf');
    //var myNewFile = DriveApp.createFile(pdf1);
    var blob = response.getBlob()
    var bytes = blob.getBytes();
    var encoded = Utilities.base64Encode(bytes);
    return encoded
  }
  </code></pre>
  <p>And that works well.
  Now, from client side, I want to download the base64 (is an html RAW content) as a pdf file (or .html if it is possible), but If I try to do like this I obtain a blank pdf page</p>
  <pre><code>function downloadRAW() {
    var encoded = window.value;
    var element = document.createElement('a');
  
    element.setAttribute('href', 'data:application/pdf;base64,' + encoded);
    element.setAttribute('download', 'prova');
    element.style.display = 'none';
    document.body.appendChild(element);
  
    element.click();
  
    document.body.removeChild(element);
  }
  </code></pre>
  <p>Note that If I try to obtain a <code>text/plain;base64,</code> works perfectly (return a .txt) file; but this is not what I want.</p>
  <p>How can I achieve it?</p>