Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal to PDF problem
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Crystal to PDF problem
Miscellaneous
Thread ID:
00690539
Message ID:
00690539
Views:
46
My problem is that I am creating a dynamic pdf using crystal reports for .NET by passing a dataset to the Crystal Reports then exporting the CR to PDF format. I then am trying to write out the report to the browser for the user to print out if they wish. However, the problem I am encountering is that the pdf displays in the browser before it finishes exporting the data from the Crystal Report. Hence, I have a blank report with nothing but static contents. Below is an idea of the code I am using:

'CREATE THE CRYSTAL REPORT THEN EXPORT TO PDF

Dim oRpt As New rptBatch()

' This is the Crystal Report file created at Design Time
'oRpt.SetDataSource(pobjDS)
oRpt.SetDataSource(pobjDS)
' Set the SetDataSource property of the Report to the Dataset
CrystalReportViewer1.ReportSource = oRpt


'Note : we are creating an instance of the strongly-typed Crystal Report file here.

Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions()

Try


oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
oRpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
'Here we are exporting the report to a .pdf format. You can
' also choose any of the other formats specified above.
DiskOpts.DiskFileName = strReport
oRpt.ExportOptions.DestinationOptions = DiskOpts
oRpt.Export()

'Clear previous objects from memory


Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(strReport)
Response.Expires = 0
Response.Flush()
Response.Close()
System.IO.File.Delete(strReport)
objFunctions.SetViewedFlag(Session("FileName"))

Catch err As Exception
End Try


Please help. Thanks in advance,
Tim
Reply
Map
View

Click here to load this message in the networking platform