Export Crystal Report to PDF and open it in Acrobat Reader instead of Internet Explorer

Discussion in 'ASP .Net' started by Dave, Dec 15, 2004.

  1. Dave

    Dave Guest

    Is this possible? Here is my current code (which opens the pdf in Internet
    Explorer)

    Dim crReportDocument As
    CrystalDecisions.CrystalReports.Engine.ReportDocument
    Dim crExportOptions As CrystalDecisions.shared.ExportOptions
    Dim crDiskFileDestinationOptions As
    CrystalDecisions.shared.DiskFileDestinationOptions
    Dim Fname As String
    crReportDocument = New
    CrystalDecisions.CrystalReports.Engine.ReportDocument
    crReportDocument.Load("C:\Inetpub\wwwroot\SAFDB\JobHoursReport.rpt")
    Try
    Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
    Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

    For Each tbCurrent In crReportDocument.Database.Tables
    tliCurrent = tbCurrent.LogOnInfo
    With tliCurrent.ConnectionInfo
    .ServerName = "NOVAPRJ"
    .UserID = "sa"
    .Password = "sa"
    .DatabaseName = "NSSApplication"
    End With
    tbCurrent.ApplyLogOnInfo(tliCurrent)
    Next tbCurrent
    Catch ex As Exception
    Response.Write(ex.Message)
    Finally
    End Try

    Dim StartYear As Integer
    Dim StartMonth As Integer
    Dim StartDay As Integer
    Dim EndYear As Integer
    Dim EndMonth As Integer
    Dim EndDay As Integer

    crReportDocument.Refresh()
    Fname = "c:\Reports\" & Session.SessionID.ToString & ".pdf"
    crDiskFileDestinationOptions = New
    CrystalDecisions.shared.DiskFileDestinationOptions
    crDiskFileDestinationOptions.DiskFileName = Fname
    crExportOptions = crReportDocument.ExportOptions
    With crExportOptions
    .DestinationOptions = crDiskFileDestinationOptions
    .ExportDestinationType =
    CrystalDecisions.Shared.ExportDestinationType.DiskFile
    .ExportFormatType =
    CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
    End With
    crReportDocument.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.Redirect(Fname)
    Response.Flush()
    Response.Close()
    Response.ClearContent()
    Response.End()
    System.IO.File.Delete(Fname)
    crReportDocument.Close()
    Dave, Dec 15, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=

    Export PDF from Crystal Report .NET using ASP.NET

    =?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=, Feb 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,836
    =?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=
    Feb 5, 2004
  2. =?Utf-8?B?TWFuZGFy?=

    Export from crystal report to pdf

    =?Utf-8?B?TWFuZGFy?=, Jul 28, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    8,977
    Andrew
    Aug 12, 2004
  3. Colin Graham
    Replies:
    0
    Views:
    1,448
    Colin Graham
    Nov 17, 2004
  4. Ed Hauptman
    Replies:
    7
    Views:
    1,011
    Ed Hauptman
    Aug 7, 2009
  5. Comfort
    Replies:
    0
    Views:
    545
    Comfort
    Oct 18, 2004
Loading...

Share This Page