PrinterSettingsContainerPaperSizes Property

See PaperSizes.

Namespace:  Aspose.Words.Rendering
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public PrinterSettingsPaperSizeCollection PaperSizes { get; }

Property Value

Type: PrinterSettingsPaperSizeCollection
Examples
Shows how to access and list your printer's paper sources and sizes.
// The PrinterSettingsContainer contains a PrinterSettings object,
// which contains unique data for different printer drivers
PrinterSettingsContainer container = new PrinterSettingsContainer(new PrinterSettings());

// You can find the printer's list of paper sources here
Console.WriteLine($"{container.PaperSources.Count} printer paper sources:");
foreach (PaperSource paperSource in container.PaperSources)
{
    bool isDefault = container.DefaultPageSettingsPaperSource.SourceName == paperSource.SourceName;
    Console.WriteLine($"\t{paperSource.SourceName}, " +
                      $"RawKind: {paperSource.RawKind} {(isDefault ? "(Default)" : "")}");
}

// You can find the list of PaperSizes that can be sent to the printer here
// Both the PrinterSource and PrinterSize contain a "RawKind" attribute,
// which equates to a paper type listed on the PaperSourceKind enum
// If the list of PaperSources contains a PaperSource with the same RawKind as that of the page being printed,
// the page will be printed by the paper source and on the appropriate paper size by the printer
// Otherwise, the printer will default to the source designated by DefaultPageSettingsPaperSource 
Console.WriteLine($"{container.PaperSizes.Count} paper sizes:");
foreach (System.Drawing.Printing.PaperSize paperSize in container.PaperSizes)
{
    Console.WriteLine($"\t{paperSize}, RawKind: {paperSize.RawKind}");
}
See Also