2

RDLC レポートを Firefox で印刷したいのですが、印刷ボタンのアイコンが Firefox ブラウザーに表示されませんが、IE では問題なく動作します。

レポートを Firefox ブラウザで印刷する方法を教えてもらえますか。

4

1 に答える 1

2

Unfortunately there is no way to print an rdlc report in firefox.

Rdlc print is only works in ie, due to the activeX requirements. More info here:Configuring and Using the ReportViewer Toolbar

There is an article on msdn about how print a local report without preview, but its only works with winforms report viewer. In asp.net you cannot acces to the client's printer. Walkthrough: Printing a Local Report without Preview

Instead of print in firefox, you can export rdlc directly. For an example:

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
于 2012-10-01T10:12:36.403 に答える