Setting Crsytal Reports Printer at runtime in VB.NET
Posted on 2013-05-30
On my old development PC (Win7Pro / Vb.NET 2008 / CR) I had a routine that allowed users to print a selection of documents using pre-defined crsytal report templates.
Basically we could setup a list of documents to print and configure the printers that they were printed to.
Now I have a Windows8 PC with Vb.NET 2010 and CR 2011, this code is no longer working.
It appears that the CR object ignores the printer parameters and prints to the default windows printer. The code I used was very simple:
' Set the required Printer & Tray
crxReport.PrintOptions.PrinterName = oDocParams.PrinterName
crxReport.PrintOptions.PaperSource = oDocParams.PrinterTray
However is doesn't matter what you set the printer name to (and yes I am setting to printers configured on the PC!) likewise for the tray.
The only thing that appears to work is the number of copies:
crxReport.PrintToPrinter(oDocParams.Copies, True, 0, 0)
I am referencing the full blown crystal report object not hte one included in .NET
I'm guessing the printing subsystem in Windows 8 is overiding the CR settings......
Anyone have any ideas?