PrinterSettingsContainer Class

Represent a storage for some parameters of PrinterSettings object.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.Words.RenderingPrinterSettingsContainer

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

ExpandedSyntax

public class PrinterSettingsContainer

The PrinterSettingsContainer type exposes the following members.

ExpandedConstructors

  NameDescription
Public methodCode examplePrinterSettingsContainer
Creates a container for PrinterSettings.

ExpandedProperties

ExpandedMethods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedRemarks

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

ExpandedExamples

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());

Console.WriteLine($"This printer contains {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)" : "")}");
}

// The "PaperSizes" property contains the list of paper sizes to instruct the printer to use.
// Both the PrinterSource and PrinterSize contain a "RawKind" property,
// which equates to a paper type listed on the PaperSourceKind enum.
// If there is a paper source with the same "RawKind" value as that of the printing page,
// the printer will print the page using the provided paper source and size.
// Otherwise, the printer will default to the source designated by the "DefaultPageSettingsPaperSource" property.
Console.WriteLine($"{container.PaperSizes.Count} paper sizes:");
foreach (System.Drawing.Printing.PaperSize paperSize in container.PaperSizes)
{
    Console.WriteLine($"\t{paperSize}, RawKind: {paperSize.RawKind}");
}

ExpandedSee Also