Skip to Content

Crystal Report Hang When Load Report

Hi Everyone,

Currently i'm having trouble to solve an issue which caused Crystal Reports hang when loading process. Below are the scenario:

1. Basically, i've built an windows service to export Crystal report to PDF simultaneously

2. But some times when the service export the reports until certain limit, the service will suddenly Hang, meaning Crystal Report suddenly stuck in the middle of ReportDocument.Load() function, which caused i need to restart the service in order to let the service be able to load the report again.

I believed that i've put all the necessary codes to release/free memory resources which attached to the report object when the report is exported, such as:

1. reportDocument.Close();

2. reportDocument.Dispose();

3. GC.Collect();

But still, the issue has not been solved yet. I've did a lot of research and found that actually this problem is somehow related to the PrintJobLimit configuration, but before i change the configuration, i would like to know:

1. Is there any way except than increasing the print job limit can solve this issue ?

2. If increasing the print job limit is the only option, can anyone explain to me how does the print job limit works ? Is one page of report considered as 1 print job ? If that's the case, then why i can still be able to export a report that contains 100 more pages without any issue while my print job limit is 75?

Any advice from you will be very appreciated. Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Best Answer
    Dec 12, 2018 at 02:19 PM


    Wrong, CR will not check the spool to see if it's busy. The problem is the engine is busy trying to spool the job to the printer and the spooler is busy so CR can't load a new report.

    As I said, write code to monitor the Spooler, Microsoft has samples.


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 11, 2018 at 10:00 PM

    Dell had it close.... The default is 75 jobs, setting it to 1 doesn't make any difference because it's the engine that is processing the report. The engine (crpe32.dll) has been around for so long it is very efficient at processing print job's and difficult to actually over load it in a .NET app. The 75 job limit is for job queing/cashing. It was the optimum at the time R&D set it as to how many job's it should cache.

    Setting it to -1 is unlimited but be careful doing so, it can hang if you through 10K reports that take time to process.

    InProcServer is not the same thing a PrintJob's by the way.

    Back the issue, good find, CR is integrated into the Hardware and software. So when printing CR/.NET is well aware the Print Spooler is busy so it waits for a clear signal. If one doen't come it's likely the printer can't handle that many jobs and doesn't know how to handle errors properly. Or you did not put the routine in a try/catch block to capture the error from the Spooler/Printer. That's the problem with dll's, error handling is not always reported properly, it's just the nature of the dll's. If it's generated by CR we can hadnle the exception or inner exception, if it's genenrated by a third party function we don't always get a meaningful error message. What ever CR get's CR simply passes it through... not always informative...

    Google "Printing Status" in .NET and you'll find code examples of querying the printer to get a status from it, you could integrate that into your app so if the printer is "too busy" to handle more jobs pause your app while the pirnter cleans up the jobs.


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 10, 2018 at 03:40 PM

    Here's how print jobs work:

    Your main report is 1 print job regardless of how many pages it has.

    Each time a subreport runs is another print job. For example, if you have a subreport that runs in the Report Header, it only runs once in the report so it counts for 1 print job so the total for the report is 2 print jobs. However, if you have a subreport in the details section that runs for every record, you have as many print jobs as you have records in the report, plus 1 for the main report. Since the SDK limits you to 100 concurrent print jobs, if you have 100 records in your report, you have 101 print jobs and the report will fail.

    I believe print jobs only apply when you're refreshing or exporting, This is probably not what causing the issue on your report load. I would make sure that you do not have "Save Data with Report" turned on for any of your reports (Crystal has it turned on by default) so that when you call .Load() you're only loading the report itself, and not loading one that already has data in it.


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 11, 2018 at 05:37 AM

    Hi Dell,

    Thanks for your answer, really appreciate it. But regarding the print job, i still have one question. I purposely set the print job limit in both Server and InprocServer as "1", but why i can still print a report which contains Sub Report ? Based on your answer, by right i shouldn't be able to print the report isn't it ?

    Now seems like i've figured out why my report hang when loading. I think is because due to after the reports being generated from service, actually we send the report to printer using Windows Process (System.Diagnostics.Process) to print out the report. But i noticed that when there're too much jobs sent to printer, somehow crystal report would be affected and it turned out "Freeze" when call .Load() function.

    So my questions would be:

    1. If too much print jobs were sent to printer, will it caused the crystal report hang when loading ?

    2. If it is due to too much jobs sent to printer at once, may i know is it somehow related to crystal report memory resource issue ? If yes, are .Close() and .Dispose() function not enough to release the memory resource for crystal report ?

    Really appreciate your advice and help on this, many thanks.


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 12, 2018 at 06:44 AM

    Hi Don,

    Thanks for your reply. So based on your explanation, can i assume that:

    When Load report, CR actually will check the print spooler during that time, if there're too many print queue, it will cause CR freeze even when loading process ?

    If that's the case, I've two question:

    1. Can you let me know what is the maximum print jobs queue that will caused CR hang ? Because i couldn't find any relevant answer regarding this issue.

    2. Or is there any settings or option to prevent CR to do the checking with print spooler to prevent this from happening ? I've tried to check the "No Printer" option, but seems like it doesn't work, CR still hang when perform .Load() report if there're too many print queue.

    Any advice from you will be very appreciated, thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 13, 2018 at 03:50 AM

    Hi Don,

    So meaning if spooler is too busy, CR wont be able to load a new report even though we'll not send the generated report to printer right ? If that's the case, i've understand thanks for your explanation and advice.


    Add comment
    10|10000 characters needed characters exceeded