Quantcast
Viewing all articles
Browse latest Browse all 3636

Crystal Reports prints to default printer no matter what

We have a .NET/C# application and we upgraded from Crystal v10.2 to v13 recently.

With the v10.2 we used the .NET API. After upgrade we experience a problem: no matter how I we to set the printer name (to the selected printer by user) before printing Crystal prints to the default printer. There are strange exceptions, for example mostly I can print to my local "Microsoft XPS Document Writer", so somehow that can override the stubborn behavior (but not always!). When I try to print to my local "Send to OneNote 2010" printer or other printer however, the report is printed to our default network printer for sure.

When I debug our code with Visual Studio 2012, I can clearly see that:

1. With .NET API: the Crystal ReportDocument object's PrintOptions object's PrinterName property is an empty string, and when I try to assign the desired printer name (like "Send to OneNote 2010"), it simply ignores my try. This is even true if I try to manipulate the object in the debugger or in the Immediate Window.

2. I tried the RAS API too. I can query the RAS object (which has the type of CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument) from the .NET ReportDocument, I guess the .NET API just wraps around the RAS objects. I see that the PrinterName is empty there too. I try to manipulate it through the PrintOutputController, like:

boReportClientDocument.PrintOutputController.ModifyPrinterName("Send to OneNote 2010");

but that try fails either.

 

About our reports (.rpt files): we should have the "No Printer" checked in all of them (we have like 300 reports in our apps). Now it seems that some of them doesn't have that set, but in those cases changing that would cause problems with our clients. The editor we use doesn't show the "Dissociate Formatting Page size and printer" checkbox in "File/Page Setup".


Viewing all articles
Browse latest Browse all 3636

Trending Articles