Get List of Printers Using c#


using System.Drawing.Printing;

PrintDocument prtdoc = new PrintDocument();
//Here we get the default printer
string strDefaultPrinter = prtdoc.PrinterSettings.PrinterName;
foreach (String strPrinter in PrinterSettings.InstalledPrinters)
{
         //here we can put the list in combo box.
         cbPrintername.Items.Add(strPrinter);
         if (strPrinter == strDefaultPrinter)
         {
                cbPrintername.SelectedIndex = cbPrintername.Items.IndexOf(strPrinter);
          }
}

1 comment: