IRONSOFTWAREHOME

How to Retrieve Printer Names in C#

Curtis Chau
Curtis Chau
Updated: August 2, 2026

Knowing which printers are available on a system is a common prerequisite for any .NET application that sends documents to print. Whether the goal is to let users pick a printer from a dropdown or to route print jobs to a specific device automatically, retrieving printer names programmatically is the first step.

IronPrint exposes a single static method - Printer.GetPrinterNames() - that returns every installed printer on the current Windows machine as a List<string>. We cover installation, synchronous and asynchronous retrieval, and how to feed a selected printer name into a print job below.

Quickstart: Retrieve Printer Names
  1. Install IronPrint via NuGet: Install-Package IronPrint
  2. Add using IronPrint; to the file
  3. Call Printer.GetPrinterNames() to get a List<string> of printer names
  4. Iterate over the list and display or store each name
  5. Pass a selected name to PrintSettings.PrinterName when printing
  1. 1Install IronPrint with NuGet Package Manager

    PM > Install-Package IronPrint

  2. 2Copy and run this code snippet.

    using IronPrint;
    
    // Retrieve every printer installed on this machine
    List<string> printers = Printer.GetPrinterNames();
    
    foreach (var name in printers)
    {
        Console.WriteLine(name);
    }
    C#
  3. 3Deploy to test on your live environment

    Start using IronPrint in your project today with a free trial
    arrow pointer

How Can I List All Installed Printer Names?

Printer.GetPrinterNames() queries the operating system and returns every registered printer as a List<string>. We call this method once and iterate over the result:

using IronPrint;
using System;
using System.Collections.Generic;

// List every installed printer
List<string> printerNames = Printer.GetPrinterNames();

Console.WriteLine($"Found {printerNames.Count} printer(s):\n");

// Print each printer name
foreach (string name in printerNames)
{
    Console.WriteLine($"  • {name}");
}

Console Output

Found 3 printer(s):

  • Microsoft Print to PDF
  • HP LaserJet Pro MFP M428
  • OneNote (Desktop)
Text

The returned list includes local printers, network printers, and virtual print drivers. Each string matches the exact name shown in the Windows Settings > Printers & scanners panel, so it can be used directly in print settings configuration.

If no printers are installed, the method returns an empty list rather than throwing an exception. A quick printerNames.Count check is all that's needed before presenting options to a user.

How Do I Retrieve Printer Names Asynchronously?

For applications where blocking the UI thread is not acceptable - WPF, MAUI, or ASP.NET web apps - IronPrint provides Printer.GetPrinterNamesAsync(). The method returns a Task<List<string>> and works identically to its synchronous counterpart:

using IronPrint;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

// Retrieve printer names asynchronously
List<string> printerNames = await Printer.GetPrinterNamesAsync();

// Print each printer name
foreach (string name in printerNames)
{
    Console.WriteLine(name);
}

We await the call just like any other async API. The result is the same List<string> returned by GetPrinterNames(), so no additional parsing or conversion is necessary. This async pattern integrates naturally with async Task controller actions and async void event handlers.

How Do I Print to a Specific Printer by Name?

Once we have the printer name, we assign it to PrintSettings.PrinterName and pass the settings object to Printer.Print(). This sends the document directly to the chosen printer without displaying a dialog:

using IronPrint;
using System.Collections.Generic;

// Retrieve available printers
List<string> printers = Printer.GetPrinterNames();

// Select a printer matching "LaserJet", or fall back to the first available
string targetPrinter = printers.Find(p => p.Contains("LaserJet"))
                       ?? printers[0];

// Configure print settings
PrintSettings settings = new PrintSettings
{
    PrinterName = targetPrinter,
    PaperSize = PaperSize.A4,
    NumberOfCopies = 1
};

// Print the document
Printer.Print("invoice.pdf", settings);

PrintSettings supports additional properties such as Dpi, PaperOrientation, Grayscale, and PaperMargins. See the full list in the PrintSettings API reference and the print settings how-to guide.

We also retrieve available paper trays for a given printer using Printer.GetPrinterTrays(printerName), which is useful when a print job needs to pull paper from a specific tray.

What Are My Next Steps?

We covered four operations: installing IronPrint, listing all printer names with GetPrinterNames(), running the same query asynchronously with GetPrinterNamesAsync(), and routing a document to a specific printer through PrintSettings.PrinterName.

For further reading and deeper examples, explore these resources:

Get a free trial license to test every feature in a live environment, or view licensing options when you're ready to deploy.

Frequently Asked Questions

How can I retrieve printer names in C#?

You can use the IronPrint library and its method `Printer.GetPrinterNames()` to retrieve a list of installed printer names on a Windows machine.

Is there an asynchronous method to get printer names using IronPrint?

Yes, IronPrint provides `Printer.GetPrinterNamesAsync()`, which allows retrieval of printer names without blocking the UI thread.

How do I install the IronPrint library for C#?

To install IronPrint, you can use NuGet with the command `Install-Package IronPrint` in your .NET project.

Can I print to a specific printer using IronPrint?

Yes, after retrieving printer names, you can assign the desired printer name to `PrintSettings.PrinterName` and use `Printer.Print()` to send a document to that printer.

What should I do if no printers are installed?

If no printers are installed, the `Printer.GetPrinterNames()` method returns an empty list. You should check the list's count before using printer names.

What additional properties can I configure with PrintSettings?

With `PrintSettings`, you can configure properties like `Dpi`, `PaperSize`, `PaperOrientation`, `Grayscale`, and `PaperMargins`.

How do I iterate over printer names in C# using IronPrint?

You can use a foreach loop to iterate over the list returned by `Printer.GetPrinterNames()`, allowing you to display or store each printer name.

Can IronPrint work with network and virtual printers?

Yes, the list returned by `Printer.GetPrinterNames()` includes local printers, network printers, and virtual print drivers.

Where can I find more information on printing settings in IronPrint?

You can refer to the [PrintSettings How-To Guide](https://ironsoftware.com/csharp/print/how-to/print-settings/) and the [API Reference](https://ironsoftware.com/csharp/print/object-reference/api/IronPrint.PrintSettings.html) for detailed information.

Does IronPrint provide support for different paper trays?

Yes, you can use `Printer.GetPrinterTrays(printerName)` to retrieve available paper trays for a given printer.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 46,090Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPrint
nuget.org/packages/IronPrint/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPrint"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronPrint to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPrint.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required