cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Printer to No Printer At Runtime

copco_online
Explorer
0 Kudos
339

Using Crystal XI SP2, we have many reports and are doing a migration. We're finding that in some cases of running the report, there is a huge delay. The "This report uses an invalid printer. The default printer will be used instead." What seems to be happening is that a printer had been defined and could not be found. I know we can go into each report and set "No Printer". However, with hundreds of reports, it would be preferable to be able to handle correcting the issue, at runtime, through our report generation code. Can anyone suggest how to do this?

We tried the setPrinter option = "No Printer" and it seems to not work.

Thank you,

- Nick

DellSC
Active Contributor
0 Kudos

What is your code around setting the printer to No Printer?

-Dell

copco_online
Explorer
0 Kudos

I believe we tried the following:

oCRReport.setPrinter = "No Printer";

This can only happen once the base report has been loaded. I think we are not approaching it correctly.

Accepted Solutions (1)

Accepted Solutions (1)

DonWilliams
Active Contributor
0 Kudos

Hi Nick,

That was an old bug, the Engine would search the network for the original report so CR added Dissociate option in the Page Setup to stop it from looking, it would look for any printer the closely matches the design printer saved in the RPT file.

Unfortunately CR XI R2 is no longer available, I believe it was fixed in a later patch.

If you look at this printer test app you will notice code to test if not printer is used, to be able to change the printer you use a dummy report with the printer info defined for that use/report.

Printing Crystal Reports in .NET

I never suggested using No printer, CR has dependencies on the hardware and the printer so always use a real printer.

So first thing to do is upgrade to the latest CR for VS runtime here:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

Note: CR runtime is no longer included with Crystal Reports install, this is the one to use now for all versions of Visual Studio - 2010->2022.

And this blog on upgrading:

https://blogs.sap.com/2020/10/30/upgrading-a-visual-studio-2008-2019-.net-project-with-the-latest-cr...

Don

Answers (1)

Answers (1)

copco_online
Explorer
0 Kudos

Hi Don. I'll mark your response as accepted and appreciate it very much. I have a number of thoughts/questions.

First, it was not clear to me what the purpose of the application in the Printing Crystal Reports in .NET was doing. Our implementation involved the creation of classes which handled the loading of reports and subreports. The number of reports in the hundreds. We were able to locate the service packs and update the installation. However, an example of reassigning a printer at runtime would still be quite useful.

I'm not sure that I understand why a dummy report needed to be used to establish Print Options other than perhaps the thinking is that a report configured through the GUI would have all the necessary settings, as opposed to setting them one by one at runtime and needing to store them in configuration somewhere.

Thanks!

- Nick