Skip to content

Problem printing reports (Crystal Reports XI) using C# codes

Kheen On Cheah

Asked Nov 13, 2006, 4:40 PM EST4 answers
Share
LinkedInX
I have an application that basically grabs the crystal report specified and send it to the printer for printing. My working version was using Crystal Reports 8.
Recently, I'm testing to print reports created using Crystal Reports XI. I've included the new crystal decisions library into my project but whenever I try to load the report, I keep getting "Load report failed" error.

ReportDocument objDoc=new ReportDocument();

// Load the report
objDoc.Load(strReportFilename); <-- Error happens here!
...
...
...

// Print the report
objDoc.PrintToPrinter(int.Parse(copies), true, 0, 0);

4 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I downloaded the latest merge modules from BO web site and now I don't get the error anymore. No exceptions being thrown, everything works fine, however, printer is not printing.
    0
  • 0
    When I run locally, I get the error "The RPC server is unavailable". (Using network printer).

    If I deploy to the server, I don't get any error but looks like it just hangs at PrintToPrinter.
    0
  • 0

    please check whether the strReportFilename contains full report  file path


    if you are taking more than on report using some loops add the code below to remove from the garbage collection


    objDoc.Close();
    objDoc.Dispose();
    objDoc = null;
    GC.Collect();
    GC.WaitForPendingFinalizers();

    0
  • 0
    I am having the same issue for quite a while. I am using Crystal Reports XI R2 and when I call the PrintToPrinter function from within Visual Studio, the printing works fine. However, when I deploy with the merge modules on a different server then the web application hangs in the PrintToPrinter function and never returns. It seems like it is waiting for a response from the server but never comes back. I do not get a timeout error either. I have verified that this hang happens inside the PrintToPrinter function. I have not been able to find a resolution for it yet. Any help will be appreciated.
    0