This documentation is archived and is not being maintained.

PrintCapabilities.PageMediaSizeCapability Property

Gets a collection of PageMediaSize objects that identify the paper and media sizes that a printer supports.

Namespace: System.Printing
Assembly: ReachFramework (in reachframework.dll)

public ReadOnlyCollection<PageMediaSize> PageMediaSizeCapability { get; }
/** @property */
public ReadOnlyCollection<PageMediaSize> get_PageMediaSizeCapability ()

public function get PageMediaSizeCapability () : ReadOnlyCollection<PageMediaSize>

You cannot use this property in XAML.

Property Value

A ReadOnlyCollection of PageMediaSize objects.

Most of the properties of PrintCapabilities that have "Capability" at the end of the name, such as CollationCapability, are collections of values of an enumerated type. But PageMediaSizeCapability and PageResolutionCapability are collections of objects. For the latter two properties, you cannot test for the presence of a particular value by using the Contains method of ReadOnlyCollection. This is because, with reference types, the method returns true only when the memory address of the object passed to it is the same as the address of an object in the collection; that is, they are the same object. Since this will not usually be the case, the method will nearly always return false even if there is an object in the collection with exactly the same values in all its properties as the object passed to the Contains method of ReadOnlyCollection. To determine the contents of the PageMediaSizeCapability, you must enumerate through each of its members, comparing them with the desired value.

If the printer does not support media size selection, the collection is empty.

This property corresponds to the Print Schema's PageMediaSize keyword.

The following code example shows how to search for a particular value in the PageMediaSizeCapability.

foreach (PageMediaSize mediaSize in pc.PageMediaSizeCapability)
        if (mediaSize.PageMediaSizeName == PageMediaSizeName.ISOA4)
            Console.WriteLine("A4 size is supported");

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0