Search code examples
c#asp.netpdfreportviewerlocalreport

Render LocalReport from Reportviewer in Black and White PDF


This is how I export my report from ReportViewer in 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();

Is it any way to export this report in Black and White Only?


Solution

  • I will post my solution in case if somebody will have this questions.

    I add one more parameter in rdlc report IsPrintType. This is boolean parameter. In SSRS you can set report to be black and white only. When you click your print button, reload report with this parameter > print report using code above > reload report back with color

    If need code sample, just let me know