Skip to Content
0

Crystal Reports - Intermittent printer spool stop using SDK

Aug 10, 2017 at 10:57 AM

96

avatar image
Former Member

We’re using Visual Studio 2013 to build a 32-bit DLL to print and preview crystal reports which are designed in-house. This DLL is then called by our main software. The latest DLL is built using SAP Crystal Runtime SP20, 32-bit with the ‘CrystalDecisions.ReportAppServer’ assembly. We load the report using ‘CrystalDecisions.CrystalReports.Engine.ReportDocument’ set parameters, change the report and sub reports database and table locations and then send to a printer, using the ‘PrintOutputController.PrintReport(PrintOptions)’ command.

Intermittently, on the customer environment, we see a stop in printing on the above ‘PrintReport()’ call. The main software sees a pause while waiting for our DLL. It appears, via logs, that the DLL is waiting for PrintReport() response, which never returns. In the print queue, we can see the document waiting and other reports queuing behind. The only way to recover, is to stop that particular print document or to force close the main software entirely. This has also been reported by other customers, with different reports and printers. Different drivers have been installed locally and on a network. Different operating systems have been tried including Windows 10.1. All raise the same error. Development machine: Windows 7 64-bit, .Net 4.5, Visual Studio 2013. Target Client machines: Windows 7 and 8, .Net 4.5.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Don Williams
Aug 11, 2017 at 03:29 PM
0

Hi Simon,

I hear this often so I searched on how to get printer job status reports from the Printer service and found this great article from Microsoft:

https://msdn.microsoft.com/en-us/library/aa970685%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396

Add/create an app that can query the Printers and see what the problem is, it could be an issue with the driver, the framework or memory etc.

Sending off large print jobs to the Printer that is not capable of holding that much info in it's memory can cause issues like yours.

CR simple streams the job to the printer, once it's completed though it does wait for a response from the printer the job is complete, if it does not reply then the app will appear to hang.

So it would be interesting to know what error is actually being generated by the spooler.

Don

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Don,

We have created an application to monitor activity on the printer server. We have the results on a database table.

It mainly shows that these job status’ are in a constant Spooling state, until the end windows users closes down the software executable.

As the client side executable is forced to end in task manager on the local machine, the print job then goes straight into the Deleting, Spooling State, but we do not receive any errors in the message queue at all, the constant spooling state is seemingly infinite.

Simon

0

Hi Simon,

mmmm bummer, I was hoping it would catch something but it also suggests there is nothing wrong.

Is there something in the reports that can cause this? Are the users allowed to basically SELECT * From Database and dump that into a report and print? For example over 7 million rows of data...

How long have they waited for the job to complete? Windows will show ( Not Responding ) because CR is waiting for a message to be returned, it is still running, just waiting for a reply from the spooler.

As an option you could export to PDF and then print the PDF file and see if that still causes the issue. If it hangs during exporting then it tells us something is missing from the report.

Do you have logging in your app that you can turn on to capture what the users are dong, which report being used etc,?

Don

0
Former Member
Don Williams

Hi Don,

The end user has little control on the makeup and input of the report. We simply pass in one or two parameters.

The end users have, in the past, had waits for over an hour, at which time they force close the application.These prints normally takes a few seconds. We know something is wrong when we don't get a response after around a minute.

I'll put the PDF idea forward.

We already have extensive logging and error catching. We have found this issue on a number of reports and users. But it does happen mainly on a few reports on a few machines. These tend to be of high volume.

Thank you for you help.

Simon

0
Don Williams
Aug 31, 2017 at 08:45 PM
0

Hi Simon,

If it's not consistent then it is environment on those users PC or something they are doing differently maybe.

Do they have the Printers installed?

Updated runtime? CR had a bug in older versions that the report engine would look for the exact printer used when designed. We fixed that and added Dissociate to the page setup properties.

If they are using Terminal Server to connect that is another bug MS introduced, install the printers locally and don't use the Redirected 2 drivers.

Could be AV software also, look in their logs for anything.

Also look in the event viewer to see if anything is logged.

I haven't seen this myself so I can't suggest anything else....

Maybe Modules or ProcessMonitor logs and compare good/bad logs, same report, same time.

Is this a Server app you wrote? If it is how many report jobs are being executed at one time?

CR for VS was never designer for high load situations, it's all inProc and never designed to do that.

How many reports are being processed at one time?

Don

Share
10 |10000 characters needed characters left characters exceeded