Page 1 of 1

call viewer.onEmailReport from a custom function

Posted: Fri Jan 23, 2026 12:24 pm
by mrapi
I've placed a custom button on viewer,in this case how to invoke viewer.onEmailReport from my custom the button?
thanks

Re: call viewer.onEmailReport from a custom function

Posted: Fri Jan 23, 2026 11:15 pm
by mrapi
seems I found a solution to send pdf report to my app controller from js viewer

Code: Select all

             
   const settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
   const service = new Stimulsoft.Report.Export.StiPdfExportService();
   const stream = new Stimulsoft.System.IO.MemoryStream();

 service.exportTo(report, stream, settings);

await fetch("/api/sendmail", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: {
     "data": Stimulsoft.System.Convert.toBase64String(stream.toArray()),
      "email": "my@mail.com",
      "subject": "subject",
      "message": "message"
  }
});

Re: call viewer.onEmailReport from a custom function

Posted: Mon Jan 26, 2026 9:31 am
by Lech Kulikowski
Hello,

Thank you for sharing your experience with other users.