1

I use this code to create a blob PDF file using HTML and attach it to email. Is it possible to directly download the created PDF blob to local computer? If not, what's a better alternative to download the created blob file?

var html = `
    <html>
      <body>
       <p>Hello World!</p>
      </body>
    </html>`


  const blob = Utilities.newBlob(html,MimeType.HTML);
  blob.setName(`Test.pdf`);

  const subject = `Email Subject`;
  MailApp.sendEmail({
    to: email,
    subject: subject,
    htmlBody: "Test", 
    attachments:[blob.getAs(MimeType.PDF)],
  });
Jim E Russel
  • 457
  • 10
  • 31

0 Answers0