I have an application that allows the user to select the target printer from the list of available printers on the system.
The following code generates the list of printers from which they select:
Dim PrinterList As New List(Of String)
Dim PrintServer = New LocalPrintServer
Dim PrintQueues = PrintServer.GetPrintQueues(New EnumeratedPrintQueueTypes() {EnumeratedPrintQueueTypes.Connections, EnumeratedPrintQueueTypes.Local})
For Each p In PrintQueues
PrinterList.Add(p.FullName)
Next
The selected value is saved. When I go to print, I use the following code to select the printer:
ClientInstructions.PrintOptions.PrinterName = My.Application.PrinterSettings.ActiveLetterheadPrinter
Edited by: Don Williams on Aug 10, 2010 7:08 AM
My first instinct is that there is a configuration problem with the redirected printer. I have little experience with redirected printers personally, but have you looked at the Event viewer on the Terminal Server to see if there are any entries related to printing?
For those wondering what redirected printing is, I found this site useful http://blogs.technet.com/b/askperf/archive/2007/08/24/terminal-server-and-printer-redirection.aspx.
This works 90% of the time. I occasionally get the following error:
Error generated by: Print Client Instructions - Print Record Copy
Error Message: Invalid printer specified.
temp_63b3d1f8-dedf-4eee-a119-0d301e2a98fa {34670353-397C-4316-B1EC-206D545CB318}.rpt
HelpLink:
Source: Analysis Server
Target (Method): Void ModifyPrinterName(System.String)
Stack Trace: at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ModifyPrinterName(String newVal)
at CrystalDecisions.CrystalReports.Engine.PrintOptions.set_PrinterName(String value)
at Workflow_WPF.ReportPrinting.PrintClientInstructions(RecordEntry ClientInstruction, Boolean ClientCopy, Boolean RecordCopy, Boolean Envelope, objVisitData WorkingData) in D:\TomGarg\Documents\Visual Studio 2008\Projects\WMS WPF\WorkflowClientApp\Modules\ReportPrinting.vb:line 1037
Printer: hp OfficeJet 8500 Premier (redirected 2)
When I use other redirectred printers, it works fine.
Any idea what I am doing wrong? Any thoughs are greatly appreciated.
Add a comment