简体   繁体   English

以黑白PDF格式从Reportviewer渲染LocalReport

[英]Render LocalReport from Reportviewer in Black and White PDF

This is how I export my report from ReportViewer in PDF: 这是我从PDF中的ReportViewer导出报告的方式:

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? 有什么办法可以仅以Black and White导出此报告?

I will post my solution in case if somebody will have this questions. 如果有人有这个问题,我将发布解决方案。

I add one more parameter in rdlc report IsPrintType . 我在rdlc报告IsPrintType添加了另一个参数。 This is boolean parameter. 这是布尔参数。 In SSRS you can set report to be black and white only. 在SSRS中,您可以将报告设置为仅黑白。 When you click your print button, reload report with this parameter > print report using code above > reload report back with color 当您单击打印按钮时,请reload report with this parameter > print report using code above > reload report back with color

If need code sample, just let me know 如果需要代码示例,请告诉我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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