PrinterSettingsContainer Class

Represent a storage for some parameters of PrinterSettings object.

Inheritance Hierarchy

SystemObject
  Aspose.Words.RenderingPrinterSettingsContainer

Namespace:  Aspose.Words.Rendering
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0

Syntax

public class PrinterSettingsContainer

The PrinterSettingsContainer type exposes the following members.

Constructors

  NameDescription
Public methodCode examplePrinterSettingsContainer
Creates a container for PrinterSettings.

Properties

Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)

Remarks

Access to data of PrinterSettings takes long time. PrinterSettingsContainer caches parameters from PrinterSettings, so printing works faster.

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