CR - VS.NET 2005 - Selecting the Printer

Hello,

I'm trying to have a report print to a designated printer. My code is as follows:



Print rptDoc as ReportDocument
.. Some Code for Report Selection ..
rptDoc.PrintToPrinter(iCopies, Collate, 0, 999999)

 


The code works fine except for the fact that it prints to the default printer. Basically what I want is to show a printer dialog box and then print to the selected printer.

Right now to achieve this, I have to preview the report and then the user needs to click on the Print icon which in turn shows the printer dialog.

Hopefully this makes sense. I've been working on something for the past 20 hours. I'm beat and beginning to Hallucinate!

Thanks in advance.


Answer this question

CR - VS.NET 2005 - Selecting the Printer

  • Freddo

    Hello,

    It is not possible to have the printer dialog shown when using the PrintToPrinter method.

    You can use your own custom printer dialog and then pass the settings to the PrintOptions of the Report Document.  Print option has properties like PrinterName, PaperSize etc.

    Another option would be to use the PrintReport method of the Crystal Report viewer.  This will always prompt the user with a printer dialog box.  You will still need to load the report into the Report Viewer, but you could hide the viewer so the user will not see it.

    Keith - Business Objects

  • cmccutcheon

    Keith,

    Thanks for the reply. I used the PrintReport method and that gave me what I was looking for.

    Thanks a lot

  • CR - VS.NET 2005 - Selecting the Printer