protected void btnPrint_Click(object sender, EventArgs e) { Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string deviceInfo = string.Empty; deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"; byte[] data = ReportViewer1.ServerReport.Render( "PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); //Identify the Client Machine Desktop folder Path string ClientDesktopPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), ""); //DirPath = Server.MapPath(@"" + "~/Temp") + @"\" + "TempReportFiles";//Server.MapPath("~") returns the physical path to the root of the application PDFFileName = "OutPutTmpRpt" + SessionHandler.UserID.Trim() + ".pdf"; //Set the File name here using (FileStream fs = new FileStream(ClientDesktopPath + @"\" + PDFFileName.Trim(), FileMode.Create)) { fs.Write(data, 0, data.Length); fs.Close(); fs.Dispose(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)