I am using VS2005 and I am creating reports in Crystal that are getting exported to Adobe. Once the report is generated, it is written to the client's browser and then opened. Everything works great when users are on a PC. However when I have users on a MAC, Firefox will open the report, but Safari will not. Does anyone have a clue as to why this is? Below is the code I am using for this export.
Code:
Protected Sub PrintReport()
' Define Crystal Reports variables
Dim crTableLogonInfos As New [Shared].TableLogOnInfo()
Dim crTableLogonInfo As New [Shared].TableLogOnInfo()
Dim crConn As New [Shared].ConnectionInfo()
Dim crTables As Tables
Dim crTable As Table
Dim crReportDocument As ReportDocument
Dim crExportOptions As [Shared].ExportOptions
Dim crDiskFileDestinationOptions As [Shared].DiskFileDestinationOptions
Dim Fname As String
' The following code can be placed directly after the call to
' InitializeComponent() in the formâs constructor, or inside of
' a Button_Click event where the button is used by the client to
' get a printable copy of the report.
crReportDocument = New ReportDocument()
' The following line of code loads the sample report âChart.rptâ that installs
' with Visual Studio .NET
crReportDocument.Load(Request.PhysicalApplicationPath + "\Reports\ChurchMembTotReport.rpt") ', OpenReportMethod.OpenReportByTempCopy)
crConn.ServerName = "Server_Name"
crConn.DatabaseName = "Database_Name"
crConn.UserID = "Username"
crConn.Password = "password"
crTables = crReportDocument.Database.Tables
For Each crTable In crTables
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.ConnectionInfo = crConn
crTable.ApplyLogOnInfo(crTableLogonInfo)
Next
Fname = "C:\inetpub\" & Session.SessionID.ToString & ".pdf"
crDiskFileDestinationOptions = New [Shared].DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = [Shared].ExportDestinationType.DiskFile
.ExportFormatType = [Shared].ExportFormatType.PortableDocFormat
End With
crReportDocument.Refresh()
crReportDocument.Export()
' The following code writes the pdf file to the Clientâs browser.
Response.ClearContent()
Response.ClearHeaders()
'Response.ContentType = "application/pdf"
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'delete the exported file from disk
System.IO.File.Delete(Fname)
End Sub