PrintTaskConfiguration PrintTaskConfiguration PrintTaskConfiguration PrintTaskConfiguration Class

Allows a client to retrieve the print task extension context, and also to add an event handler to the print task.

Syntax

Declaration

public sealed class PrintTaskConfigurationpublic sealed class PrintTaskConfigurationPublic NotInheritable Class PrintTaskConfiguration

Remarks

When a Windows Store app is invoked from More settings in the print window, the activation event provides an event argument of type WebUIPrintTaskSettingsActivatedEventArgs that exposes a property, Configuration, for controlling the printer. This property provides an object of type PrintTaskConfiguration that provides access to the print task extension context, and also allows you to add an event handler to update the print ticket.

The following JavaScript code snippet demonstrates how to access the PrintTaskConfiguration object, and then use that to access the PrinterExtensionContext property.

var configuration;
var printerExtesionContext;

function displayPrintSettings() {

    if (!configuration) {
        sdkSample.displayError("Configuration argument is null");
        return;
    }

    printerExtesionContext = configuration.printerExtensionContext;
    printHelper = new Microsoft.Samples.Printing.WwaDca.
        PrintHelperClass(printerExtensionContext);    

    var feature = "PageOrientation";

    // if printer's capabilities include this feature.
    if (!printHelper.featureExists(feature)) {
        continue;
    }

    // Get the selected option for this feature in the current
    // context's print ticket.
    var selectedOption = printHelper.getSelectedOptionIndex(feature);

    // Get the array of options in the current context’s print ticket
    var optionIndex = printHelper.getOptionInfo(feature, "Index"),
    var optionNames = printHelper.getOptionInfo(feature, 
        "DisplayName"),

    var selectedName;
    for (var i = 0; i < optionIndex.length; i++) {
        if (optionIndex[i] === selectedOption)
           selectedName = optionNames[i];

    // logic to display the orientation string here
}

Properties summary

Gets the context for the print task extension.

Events summary

Raised by the print window for your app to notify the device app that the print ticket must be updated.

Properties

  • PrinterExtensionContext
    PrinterExtensionContext
    PrinterExtensionContext
    PrinterExtensionContext

    Gets the context for the print task extension.

    public object PrinterExtensionContext { get; }public object PrinterExtensionContext { get; }Public ReadOnly Property PrinterExtensionContext As object

    Property Value

    • object
      object
      object
      object

      The context for the print task extension.

Events

  • SaveRequested
    SaveRequested
    SaveRequested
    SaveRequested

    Raised by the print window for your app to notify the device app that the print ticket must be updated.

    public event TypedEventHandler SaveRequestedpublic event TypedEventHandler SaveRequestedPublic Event SaveRequested

Device family

Windows Desktop Extension SDK (introduced v10.0.10240.0)

API contract

Windows.Devices.Printers.Extensions.ExtensionsContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Devices.Printers.Extensions.dll