I want to render big non-graphical reports (thousands of pages) in the code level, omitting the ReportViewer
control that just jams the browser, from the .rdlc files. When I test to render a report that is somewhat 2000 pages, the Microsoft.Reporting.WebForms.LocalReport.Render
method takes approximately half an hour to finish, that is considered as bad user experience.
Are there any tricks or alternative solutions to improve the performance of the rendering: in code, re-designing the .rdlc file, or somewhere else, e.g, just increasing hardware?
Example code:
LocalReport localReport = new LocalReport();
localReport.ReportPath = Server.MapPath("~/report.rdlc");
SetDataSources(ref localReport);
string reportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0in</MarginTop>" +
" <MarginLeft>0in</MarginLeft>" +
" <MarginRight>0in</MarginRight>" +
" <MarginBottom>0in</MarginBottom>" +
"</DeviceInfo>";
}
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
//Render the report
renderedBytes = localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
Any help is much appreciated, thanks in advance!
Placing <trust legacyCasModel="true" level="Full"/>
inside <system.web>
tag in web.config
did it for me. More details here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With