PDF Problem
-
this problem already this in this forum,but my problem still be there,I googled the following code, and try to run,but did not work. --------------------------------------- CrystalReport1 report=new CrystalReport1(); CrystalDecisions.Shared.TableLogOnInfo myLogin; foreach (CrystalDecisions.CrystalReports.Engine.Table myTable in report.Database.Tables) { myLogin = myTable.LogOnInfo ; myLogin.ConnectionInfo.Password = "123456" ; myLogin.ConnectionInfo.UserID = "sa" ; myTable.ApplyLogOnInfo(myLogin) ; } CrystalReportViewer1.ReportSource=Server.MapPath("CrystalReport1.rpt"); CrystalReportViewer1.DataBind(); CrystalReportViewer1.RefreshReport(); CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions(); report.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; report.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; diskOpts.DiskFileName =Server.MapPath("Output.pdf"); report.ExportOptions.DestinationOptions = diskOpts; report.Export(); Response.AddHeader("Content-Disposition","attachment;filename=Output.pdf"); Response.ContentType = "application/pdf"; Response.WriteFile("C:\\Inetpub\\wwwroot\\temp\\"+ "Output.pdf"); Response.End(); Response.ClearContent(); Response.ClearHeaders(); Response.Buffer = false; Download option is comming,when trying to open that pdf file after downloading or just trying to open. Error Meassage is ...... "There is an error Opening this Document.The File is damaged and could not be Repaired." --- NOTE::: In Crystal Report Viewer the data is showed. How can I solve that.I am using .Net version 2003