ashstampede
Programmer
I have pdf files that are exproted from a crystal report, i can succesfully export and write to file the crystal report -> pdf. but when i then want to show it in the browser to the user nothing apprears.
this is my export,save,write to browser code
this is my export,save,write to browser code
Code:
'export dataset to pdf file for printing
Dim Fname As String
Fname = Server.MapPath("exports/" & Session.SessionID.ToString & ".pdf")
Dim crExO As ExportOptions = report.ExportOptions
Dim crDFDO As DiskFileDestinationOptions = New DiskFileDestinationOptions
crExO.ExportFormatType = ExportFormatType.PortableDocFormat
crExO.ExportDestinationType = ExportDestinationType.DiskFile
crExO.DestinationOptions = New DiskFileDestinationOptions
crDFDO.DiskFileName = Fname
report.ExportOptions.DestinationOptions = crDFDO
report.Export()
' The following code writes the pdf file to the Client’s browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'delete the exported file from disk
'System.IO.File.Delete(Fname)