渲染LocalReport从Reportviewer在黑色和白色PDF

本文关键字:白色 PDF 黑色 LocalReport Reportviewer 渲染 | 更新日期: 2023-09-27 18:03:40

这是我如何从ReportViewer导出PDF格式的报告:

Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
byte[] myBytes;
string reportName = hfReportName.Value;
myBytes = rvReport.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
Response.Buffer = true;
Response.Clear();  
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + reportName + "_" + ddlPracGroup.SelectedItem + "." + extension);
Response.BinaryWrite(myBytes);
Response.Flush();

是否有办法只在Black and White中导出这个报告?

渲染LocalReport从Reportviewer在黑色和白色PDF

我将把我的解决方案贴出来,以防有人有这个问题。

我在rdlc报告IsPrintType中添加了一个参数。这是一个布尔参数。在SSRS中,您可以将报告设置为仅黑色和白色。当你点击打印按钮,reload report with this parameter > print report using code above > reload report back with color

如果需要代码样本,请告诉我