Report Bursting to email

Posted by: damien.murray on 15 August 2023, 8:30 pm EST

    • Post Options:
    • Link

    Posted 15 August 2023, 8:30 pm EST

    Hi,

    Is there a way to burst active reports saved as pdf to an inbox on a schedule?

    Thanks for your help

    Damien

  • Posted 16 August 2023, 7:08 pm EST

    Hi Damien,

    To send an email from a JavaScript application with an attachment using SMTP, you will need a backend server to handle the email sending process. You cannot directly send emails from a frontend application due to security restrictions.

    You can export the PDF to a blob and send it back to a server to send emails.

    For exporting a report to PDF please refer to the following lines of code:

    import { Core,PdfExport } from "@grapecity/activereports";
    
    async function sendEmail(){
      let reportId='report.rdlx-json';
      const report = new Core.PageReport();
      await report.load(reportId);
      var document = await report.run()
      var result=await exportPdf(document);
      var blob=result.data;  
      // Use this blob to send email
    }
    async function exportPdf(document){
      const pdfSettings= {  info: {  title: "report"  } }
      const result = await PdfExport.exportDocument(document, pdfSettings);
      //result.download("report"); // use this to download PDF file
      return result.blob;  
    }
    

    For sending emails I would suggest you to use nodemailer.

    For more information, on exporting report to PDF please refer to the following pages of our documentation:

    Printing and exporting the report output

    Regards,

    Akshay

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels