简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM