c# - 在代码中从 .rdlc 导出 PDF 时,如何提高 LocalReport.Render 方法的性能?

标签 c# pdf rendering reportviewer localreport

我想在代码级别呈现大型非图形报告(数千页),从 .rdlc 文件中省略只会阻塞浏览器的 ReportViewer 控件。当我测试呈现一个大约 2000 页的报告时,Microsoft.Reporting.WebForms.LocalReport.Render 方法需要大约半小时才能完成,这被认为是糟糕的用户体验。

是否有任何技巧或替代解决方案来提高渲染性能:在代码中,重新设计 .rdlc 文件,或在其他地方,例如,只是增加硬件?

示例代码:

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);

非常感谢任何帮助,提前致谢!

最佳答案

配售<trust legacyCasModel="true" level="Full"/>里面<system.web>web.config 中标记为我做的。 More details here

关于c# - 在代码中从 .rdlc 导出 PDF 时,如何提高 LocalReport.Render 方法的性能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7873003/

相关文章:

c# - 当 Pen 具有 Null 以外的 DashStyle 时,StreamGeometry 不会被栅格化

java - 使用 ImageIcon 磁贴在 JPanel 上进行主动渲染? #Java

c# - 即使分配了图像 url C#,图像文件也没有显示

c# - Ibatis 中的动态查询

c# - 如何使用 Windows Phone 8 中的属性在 SQLite 中创建多个表

c# - 如何在 asp.net 中更改菜单菜单项中的方向箭头?

c# - 使用 iTextSharp 生成 pdf 页脚

php - writeHTMLCell() 不重置单元格高度

javascript - 在 Javascript 中对数组、变量或对象进行排序

css - 改变浏览器与 css 和 dom 的交互