如何在Firefox中打印RDLC报告

时间:2012-09-29 10:56:07

标签: c# asp.net firefox rdlc

我想在Firefox中打印我的RDLC报告但是在Firefox浏览器中没有显示“打印”按钮图标,但它在IE中工作正常。

任何人都可以指导我如何在Firefox浏览器中打印我的报告。

1 个答案:

答案 0 :(得分:2)

不幸的是,没有办法在firefox中打印rdlc报告。

Rdlc打印仅适用于ie,因为activeX要求。 更多信息:Configuring and Using the ReportViewer Toolbar

msdn上有一篇关于如何在没有预览的情况下打印本地报告的文章,但它只适用于winforms报告查看器。在asp.net中,您无法访问客户端的打印机。 Walkthrough: Printing a Local Report without Preview

您可以直接导出rdlc,而不是在Firefox中打印。 举个例子:

Warning[] warnings;
string[] streamIds;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
string filename = "YourFileName";


// Setup the report viewer object and get the array of bytes
ReportViewer viewer = new ReportViewer();
viewer.ProcessingMode = ProcessingMode.Local;
viewer.LocalReport.ReportPath = "YourReportHere.rdlc";


byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);


// Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
Response.BinaryWrite(bytes); // create the file
Response.Flush(); // send it to the client to download