Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PrintExtensionContext class

Provides the context for the printer extension object.

Syntax


/* For information about creating or accessing this object, see Remarks. */

Members

The PrintExtensionContext class has these types of members:

Methods

The PrintExtensionContext class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

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

 

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 app for Printers whitepaper.

Requirements (Windows 10 device family)

Device family

Desktop

API contract

Windows.Devices.Printers.Extensions.ExtensionsContract, introduced version 1.0

Namespace

Windows.Devices.Printers.Extensions
Windows::Devices::Printers::Extensions [C++]

Metadata

Windows.Devices.Printers.Extensions.ExtensionsContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

Windows.Devices.Printers.Extensions
Windows::Devices::Printers::Extensions [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

See also

Object
DeviceInformation class
Windows Store device app for Printers

 

 

Show:
© 2015 Microsoft