Search code examples
c#wmi.net-8.0

Get printer's default page orientation


I have a C# .NET 8.0 console application, intended to run on Windows 10. How can I get installed printer's (let's say "Microsoft Print to PDF") default page orientation?^


Solution

  • (source: https://powershell.one/wmi/root/cimv2/win32_printerconfiguration#orientation )

    Get-CimInstance -ClassName Win32_PrinterConfiguration | Select-Object -Property Name, Orientation
    

    Values for orientation (found after a short test):

    • 1 = Portrait
    • 2 = Landscape