pdf reports on asp.net web application
-
Hi, i have a asp.net web appplication. One of the pages includes report downloader. User is given a drop down menu to select different reports to download. Once they select a report and hit download button, downloader dialog box appears and let's user save report in PDF format. Report would be basically anything that SQL Stored procedure may return. Basically, i have the structure in place already. I found out on the web that I can use Crystal Report and tie that to the web form in order to generate PDF document as a report. If something other than pdf is generated (i.e. excel file), i can do something like this 'sb.Append(vbCrLf) 'Response.Clear() '' Response.ContentType = "Application/x-msexcel" 'Response.ContentType = "Application/x-msword" ''Response.OutputStream.Write(sb, 0, sb.Length) 'Response.AppendHeader("content-disposition", "attachment; filename=""" & filename & """") ''Write the file directly to the HTTP output stream. 'Response.AppendHeader("content-length", sb.Length) 'Response.Write(sb.ToString) 'Response.End() 'Response.Clear() where SB.append is string builder being tied to generate the report data. however, if i want pdf reports i can not just say "application/pdf". so, i ended up doing this Dim crReport As New ReportFile crReport.SetDataSource(dstMain) Dim strStream As New System.IO.BinaryReader(crReport.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat)) Response.ClearContent() Response.ClearHeaders() Response.ContentType = "application/pdf" Response.BinaryWrite(strStream.ReadBytes(strStream.BaseStream.Length)) Response.Flush() Response.Close() where reportfile is a crystal report page that i added to my asp.net web application. My web application is generating pdf document. However, it is coming up blank without any data. "Dstmain" is the dataset that i am filling before this code gets executed from stored procedure Any help would be appreciated. Thanks Needy
-
Hi, i have a asp.net web appplication. One of the pages includes report downloader. User is given a drop down menu to select different reports to download. Once they select a report and hit download button, downloader dialog box appears and let's user save report in PDF format. Report would be basically anything that SQL Stored procedure may return. Basically, i have the structure in place already. I found out on the web that I can use Crystal Report and tie that to the web form in order to generate PDF document as a report. If something other than pdf is generated (i.e. excel file), i can do something like this 'sb.Append(vbCrLf) 'Response.Clear() '' Response.ContentType = "Application/x-msexcel" 'Response.ContentType = "Application/x-msword" ''Response.OutputStream.Write(sb, 0, sb.Length) 'Response.AppendHeader("content-disposition", "attachment; filename=""" & filename & """") ''Write the file directly to the HTTP output stream. 'Response.AppendHeader("content-length", sb.Length) 'Response.Write(sb.ToString) 'Response.End() 'Response.Clear() where SB.append is string builder being tied to generate the report data. however, if i want pdf reports i can not just say "application/pdf". so, i ended up doing this Dim crReport As New ReportFile crReport.SetDataSource(dstMain) Dim strStream As New System.IO.BinaryReader(crReport.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat)) Response.ClearContent() Response.ClearHeaders() Response.ContentType = "application/pdf" Response.BinaryWrite(strStream.ReadBytes(strStream.BaseStream.Length)) Response.Flush() Response.Close() where reportfile is a crystal report page that i added to my asp.net web application. My web application is generating pdf document. However, it is coming up blank without any data. "Dstmain" is the dataset that i am filling before this code gets executed from stored procedure Any help would be appreciated. Thanks Needy
-
Please reply to my question if anyone has any idea ASAP. i wanted to solve this problem by mid day today. Urgent reply would be appreciated Thanks Needy