Ok, now I found a solution. Just use the normal Report
(not WebReport
) and set WebMode
to true
. The other settings on pdf-Export are just for fun.
So, this will do the trick:
public FileResult GetFile(Dataset dataset1)
{
FastReport.Utils.Config.WebMode = true;
Report rep = new Report();
rep.Load(Request.PhysicalApplicationPath + "App_Data/report.frx");
rep.RegisterData(dataset1);
if (rep.Report.Prepare())
{
// Set PDF export props
FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
pdfExport.ShowProgress = false;
pdfExport.Subject = "Subject";
pdfExport.Title = "xxxxxxx";
pdfExport.Compressed = true;
pdfExport.AllowPrint = true;
pdfExport.EmbeddingFonts = true;
MemoryStream strm = new MemoryStream();
rep.Report.Export(pdfExport, strm);
rep.Dispose();
pdfExport.Dispose();
strm.Position = 0;
// return stream in browser
return File(strm, "application/pdf", "report.pdf");
}
else
{
return null;
}
}
It's a pity that such code templates are wrong on the official site of the developer.