CrystalDecisions.CrystalReports.Engine.InternalException: Print Engine not opened

I developed a system which Exports Crystal Reports properly on the development machine. On clicking the Export button on the Testing Server I get the above error.

Both the Development machine and the Testing Server are connected to a Network Printer.

How can I solve the problem?

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim Rpt As rptGenTransactions = New rptGenTransactions
        Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
        Rpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
        Rpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
        DiskOpts.DiskFileName = "c:\Reports\Output.pdf"
        Rpt.ExportOptions.DestinationOptions = DiskOpts
    End Sub

Open in new window

Who is Participating?
nduguyettuConnect With a Mentor Author Commented:
Having waited for long without receiving any comment from an expert, I continued searching on the web until I came across some code which when I tried, solved my problem.

I am attaching the code

NOTE: The code worked very well on the development machine, but it also developed a problem when installed on the Web server. It returned an exception about an Invalid File Name. This was solved by creating the folder "Reports" on the hard drive of the server and giving Read/Write rights to the Application users.


Private DS As New xsdGenTransactions
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim rpt As New rptGenTransactions   'The report you created.        
        Dim myConnection As SqlConnection
        Dim MyCommand As New SqlCommand
        Dim myDA As New SqlDataAdapter
        myConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI; Initial Catalog=ThreeWs;")
        MyCommand.Connection = myConnection
        MyCommand.CommandText = "SELECT * FROM GenTransactions"
        MyCommand.CommandType = CommandType.Text
        myDA.SelectCommand = MyCommand
        myDA.Fill(DS, "GenTransactions")
        CrystalReportViewer1.DisplayGroupTree = False
        CrystalReportViewer1.ReportSource = rpt
    End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim Rpt As rptGenTransactions = New rptGenTransactions
        Dim crRptOpt As ExportOptions
        Dim crDiskFileDestinationOpt As DiskFileDestinationOptions
        Dim Fname As String
        Fname = "C:\Reports\" & Session.SessionID.ToString & ".pdf"
        crDiskFileDestinationOpt = New DiskFileDestinationOptions
        crDiskFileDestinationOpt.DiskFileName = Fname
        crRptOpt = Rpt.ExportOptions
        With crRptOpt
            .DestinationOptions = crDiskFileDestinationOpt
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With
        Response.ContentType = "application/pdf"
    End Sub

Open in new window

nduguyettuAuthor Commented:
I found a solution through continuous searching.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.