cancel
Showing results for 
Search instead for 
Did you mean: 

Determining print status when using PrintToPrinter()

Former Member
0 Kudos

Post Author: weevil

CA Forum: .NET

Product: Crystal Reports for Visual Studio 2005

I have some rather lengthy reports that are being sent to the printer using the PrintToPrinter() method. Since the reports can take a while to print, is there anyway to determine which page is currently printing and the total number of pages in order to give the user some feedback? An example would be:

Now printing page X of Y

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Post Author: MJ@BOBJ

CA Forum: .NET

I learned that this is meant to be used internally only so it's been "hidden". You could still use it (simply type it in) but there is a small chance that it could change behaviour in the future.

The only workaround I can think of is to use the APIs from the viewer. The viewer's SDK provides 2 methods that you could use: 1) ShowLastPage(), and 2) GetCurrentPageNumber(). Using these methods together you can get the total number of pages in the report. If you are not using the viewer, then you might have to dynamically create an instance of the viewer, bind it to the report, execute the methods, and get the page count.

Answers (5)

Answers (5)

Former Member
0 Kudos

Post Author: jportelas

CA Forum: .NET

Hi MJ@BOBJ:

this is ok when using CR 9.0, but there is no FormatEngine Property in the ReportDocument class in 10 (.net 2.0), or is the "crReport" object in the sample article an other class?

Thanks for the help.

Former Member
0 Kudos

Post Author: MJ@BOBJ

CA Forum: .NET

I think kbase c2013559 has the info you are looking for.

Former Member
0 Kudos

Post Author: jportelas

CA Forum: .NET

But I could try to get the total number of pages and print one by one, this could at least give me some more granularity in the process and would not stuck the printer with "excessive data amounts".

How can I get the total number of pages inside a reportdocument object???

Thanks again.

Former Member
0 Kudos

Post Author: MJ@BOBJ

CA Forum: .NET

Unfortunately, the CR .NET SDK doesn't provide the APIs necessary to get feedback on the status of a report job. You can get the total number of pages but that may not help in your case if you can't get the current page that is being processed.

As for the performance issue, if you are using ADO.NET DataSets to pass to the report, then you might be running into some limitations there. Of course, there's a lot of detail that would be required to help troubleshoot this issue. If you still need help, I recommend posting a new message to the forum so that we can keep the right focus on the issues.

Former Member
0 Kudos

Post Author: speshulk926

CA Forum: .NET

I noticed this too. We use Crystal 8.5 to print out some lengthy reports from vb6 and this functionality exists. I switch over to the "better" .net 2005 and use the "better" crystal xi and this functionality has been removed... Can anyone explain how to get this working? If so e-mail me at speshulk@gmail.com Also, I noticed that it is taking an exorbitant amount of time to run a report that has 400 pages on it. The almost exact same code in vb6 takes maybe 20 seconds, in .net and crystal xi it takes nearly 2-3 minutes... That a HUGE decrease in performance. Does anyone know how to maybe do it better? I can post the code I have if you need me to...thanks in advanced...