Redirecting Response Output

Stimulsoft Reports.BLAZOR discussion
Post Reply
admin@secsol.co.uk
Posts: 16
Joined: Wed Jun 01, 2022 8:26 am

Redirecting Response Output

Post by admin@secsol.co.uk »

How can I use the example as shown here to redirect the ResponseAsPdf() to a MemoryStream?


@page "/"
@using System.Data
@using System.IO
@using Stimulsoft.Base
@using Stimulsoft.Report
@using Stimulsoft.Report.Blazor
@using Stimulsoft.Report.Dictionary
@using Stimulsoft.Report.Web
@inject IJSRuntime JSRuntime

<button @onclick="@OnClickExport">Export Report</button>

@code
{
private StiReport report;

protected override void OnInitialized()
{
StiFontCollection.AddFontFile("Fonts/MicrosoftSansSerif.ttf", "Segoe UI");

base.OnInitialized();
}

private void OnClickExport()
{
StiBlazorHelper.Initialize(JSRuntime);

report = StiReport.CreateNewReport();
report.Load("Reports/Report.mrt");

StiReportResponse.ResponseAsPdf(report);
}
}
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Redirecting Response Output

Post by Max Shamanov »

Hello,

You can use the following code for export a rendered report into the stream without dialog using the provider.

Code: Select all

report.Render();
report.ExportDocument(StiExportFormat.Pdf, stream);
Post Reply