PrintExtensionContext PrintExtensionContext PrintExtensionContext PrintExtensionContext Class

Provides the context for the printer extension object.

Syntax

Declaration

public static class PrintExtensionContextpublic static class PrintExtensionContextPublic Static Class PrintExtensionContextpublic static class PrintExtensionContext

Remarks

The following JavaScript code snippet retrieves the PrinterExtensionContext using a DeviceInformation ID, and then uses the context to create a helper object:

// This function runs when the user taps the Back button
function getInkStatus(deviceInformationId) {
    var responseString;
    try {
        var context = Windows.Devices.Printers.Extensions.
            PrintExtensionContext.fromDeviceId(deviceInformationId);
        var helper = new Microsoft.Samples.Printing.WwaDca.
            PrintHelperClass(context);
        var responseString = helper.getInkLevel(1);
    } catch (e) {
        responseString = "deviceInformationId: " + deviceInformationId + 
            " Message: " + e.message;
    }
    return responseString
}

For more information about using the PrinterExtensionContext class, see the Windows Store device apps for printers topic on the Hardware Dev Center.

Methods summary

Gets the context for the printer extension object based on the DeviceInformation ID.

Methods

  • FromDeviceId(String)
    FromDeviceId(String)
    FromDeviceId(String)
    FromDeviceId(String)

    Gets the context for the printer extension object based on the DeviceInformation ID.

    public static object FromDeviceId(String deviceId)public static object FromDeviceId(String deviceId)Public Static Function FromDeviceId(deviceId As String) As objectpublic static object FromDeviceId(String deviceId)

    Parameters

    • deviceId
      System.String
      System.String
      System.String
      System.String

      The device information ID for the print device.

    Returns

    • object
      object
      object
      object

      Pointer to the context.

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
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.Devices.Printers.Extensions.dll