call viewer.onEmailReport from a custom function

Stimulsoft Reports.JS discussion
Post Reply
mrapi
Posts: 290
Joined: Sat Dec 20, 2008 1:08 am

call viewer.onEmailReport from a custom function

Post by mrapi »

I've placed a custom button on viewer,in this case how to invoke viewer.onEmailReport from my custom the button?
thanks
mrapi
Posts: 290
Joined: Sat Dec 20, 2008 1:08 am

Re: call viewer.onEmailReport from a custom function

Post 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"
  }
});
Lech Kulikowski
Posts: 7685
Joined: Tue Mar 20, 2018 5:34 am

Re: call viewer.onEmailReport from a custom function

Post by Lech Kulikowski »

Hello,

Thank you for sharing your experience with other users.
Post Reply