Printer settings: Display the list of valid resolutions : Printer « Development « C# / CSharp Tutorial






using System;
using System.Drawing.Printing;

class MainClass
{
    static void Main(string[] args)
    {
        foreach (string printerName in PrinterSettings.InstalledPrinters)
        {
            Console.WriteLine("Printer: {0}", printerName);

            
            PrinterSettings printer = new PrinterSettings();
            printer.PrinterName = printerName;

            if (printer.IsValid)
            {
                Console.WriteLine("Supported Resolutions:");

                foreach (PrinterResolution resolution in printer.PrinterResolutions)
                {
                    Console.WriteLine("  {0}", resolution);
                }
            }
        }
    }
}








14.21.Printer
14.21.1.Display all installed printer name
14.21.2.Printer settings: Display the list of valid resolutions
14.21.3.Printer settings: Display the list of valid paper sizes