Retrieving the default Printer.

Seems a bit obvious when you know how, but when you want the default printer name or the whole settings, you simply construct a PrinterSettings class and read the PrinterName property or others as desired. This is not obvious when finding your way through the MSDN documentation, in which you are shown how to fill a ComboBox with a list of InstalledPrinters, but not the next obvious step which is to pre-select the default one. Here is the whole code:-

foreach (string printerName in PrinterSettings.InstalledPrinters)
PrinterSettings defaultPrinterSettings = new PrinterSettings();
m_printerNameCombo.SelectedItem = defaultPrinterSettings.PrinterName;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s