Page 1 of 1

Redirecting Response Output

Posted: Wed Sep 28, 2022 2:40 pm
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);
}
}

Re: Redirecting Response Output

Posted: Thu Sep 29, 2022 9:10 am
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);