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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nduguyettuAuthor Commented:
I found a solution through continuous searching.

nduguyettuAuthor 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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.