Print​Task​Configuration Print​Task​Configuration Print​Task​Configuration Class

Definition

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

public : sealed class PrintTaskConfiguration : IPrintTaskConfigurationpublic sealed class PrintTaskConfiguration : IPrintTaskConfigurationPublic NotInheritable Class PrintTaskConfiguration Implements IPrintTaskConfiguration
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Printers.Extensions.ExtensionsContract (introduced v1)

Remarks

When a Windows Store app is invoked from More settings in the print window, the activation event provides an event argument of type Windows.UI.WebUI.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

PrinterExtensionContext PrinterExtensionContext PrinterExtensionContext

Gets the context for the print task extension.

public : PlatForm::Object PrinterExtensionContext { get; }public object PrinterExtensionContext { get; }Public ReadOnly Property PrinterExtensionContext As object
Value
PlatForm::Object object object

The context for the print task extension.

Attributes

Events

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
Attributes

See Also