WPF Printing - Set the Printer Automataically on WPF PrintDialog WPF Printing - Set the Printer Automataically on WPF PrintDialog wpf wpf

WPF Printing - Set the Printer Automataically on WPF PrintDialog


You first need a reference in your project to System.Printing. Then you can use the following code right after you declare your PrintDialog object.

pd.PrintQueue = new PrintQueue(new PrintServer(), "The exact name of my printer");

The PrintQueue is an object that represents the printer and everything else about that print queue.


This worked for me, when I used a shared network printer:

xPrintDialog.PrintQueue = New PrintQueue(New PrintServer("\\computer name"), "printer name")