I am using crystal reports in my application that is window based in C# for printing sale invoices and bills but the problem is that it takes some long time to proceed , I need some real time and fast method for this purpose please suggest some solution. I link my crystal report by a procedure from database, is any alternative for printing invoice rather than crystal reports...
-
are you sure that CR is slow? how do you know it is not your code which prepares data for the report (e.g. slow query)? What does 'slow' mean? How long it takes? How long do you want it to take? – Zdeslav Vojkovic Mar 04 '13 at 10:32
-
Slow in the sense some times it is not respond fast , is any other light weight alternative to do this work – Mohd Waseem Mar 04 '13 at 10:37
-
1yes, I understand that 'slow' is the same 'not fast'. What are the numbers behind it? How do you know where it is fast enough? You need to express it with numbers, not vague feeling. – Zdeslav Vojkovic Mar 04 '13 at 10:40
-
Just to clarify: I believe that CR is not the bottleneck, and it is impossible to tell without some numbers. Have you profile it? How do you know? What if 95% of time is spent in the query? Then even if you reduce time spent in CR to zero, you will only have 5% improvement. – Zdeslav Vojkovic Mar 04 '13 at 10:46
2 Answers
Crystal is "fast" if you take the time to learn what makes her happy. In my experience, the actual printing can account for most of the processing time. It may only take 25ms to create the .rpt file, but then 5000ms negotiating with a printer server. I have spent weeks wrestling with Crystal server-side printing.
It makes a BIG difference:
How you are printing :
ReportDoc.PrintToPrinter
vs.PrintOutputController.PrintReport
Whether the selected printer uses the same driver as the printer you used to develop the report.
Whether the printer is installed on the server (or just on a remote printer server) and whether it's installed in the profile of the IIS_Identity.
If you are configured incorrectly it can take 1 - 2 minutes to print a report (based on first hand experience). Make a few tweaks and you are suddenly < 50ms.
For instance, if you are using PrintToPrinter()
and the specified printer is not in the list of .NET installed printers for the IIS user, it will take a long time to print. Install the printer so it's available to the IIS user, and bam, printing is instantaneous.
-
please would mind to explain difference what the ReportDoc.PrintToPrinter and PrintOutputController.PrintReport you talked about ? your last pref explanation it not so clear for me like How do i know what printer listed on .NET list ? – samer Apr 22 '16 at 10:07
I faced an issue in one winforms project where the report was taking a long time to load but it was only for the first time. Later when reports were run, they had no issues at all.
We assumed that time was taken by framework to load crystal assemblies in memory.
So I created a hack that whenever application is run, I loaded an empty report in a background thread.

- 6,532
- 7
- 45
- 74
-
At least for older CR versions, loading [default] printer drivers for first time [after long timeout, eg in morning] sometimes takes lot of time either. Your solution - to load empty report internally - may cure that problem too. – Arvo Dec 15 '15 at 14:32