I need to get the default printer name. I’ll be using C# but I suspect this is more of a framework question and isn’t language specific.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way I found is to create a new
PrinterSettingsobject. It starts with all default values, so you can check its Name property to get the name of the default printer.PrinterSettingsis in System.Drawing.dll in the namespaceSystem.Drawing.Printing.Alternatively, you could maybe use the static
PrinterSettings.InstalledPrintersmethod to get a list of all printer names, then set the PrinterName property and check the IsDefaultPrinter. I haven’t tried this, but the documentation seems to suggest it won’t work. Apparently IsDefaultPrinter is only true when PrinterName is not explicitly set.