1
byte[] bytes = null;
string strDeviceInfo = "";
string strMimeType = "";
string strEncoding = "";
string strExtension = "";
string[] strStreams = null;
Warning[] warnings = null;
try
{
ReportDataSource rds = new ReportDataSource("f_MANPOWERREQUISITION");
ReportViewer rptViewer1 = new ReportViewer();
rptViewer1.ProcessingMode = ProcessingMode.Local;
rptViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
bytes = rptViewer1.LocalReport.Render(strFormat, strDeviceInfo, out strMimeType, out strEncoding, out strExtension, out strStreams, out warnings);
Response.Buffer = true;
Response.Clear();
Response.ContentType = strMimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + strNomFichier + "." + strFormat);
Response.BinaryWrite(bytes); // create the file
Response.Flush();
}// send it to the client to download
catch (Exception ex)
{
}
此代碼用於下載PDF文件..但我想打印該文件,以便輸出文件打開到瀏覽器的打印預覽。 因此,任何人都有助於在瀏覽器中打印PDF文件....謝謝....在Asp.net中使用響應打印rdlc報告
雅爲它工作。 – user3001050