Windows Dev Center

PrintManager.GetForCurrentView | getForCurrentView method

Retrieves the PrintManager object associated with the current window.

Syntax


var printManager = Windows.Graphics.Printing.PrintManager.getForCurrentView();

Parameters

This method has no parameters.

Return value

Type: PrintManager

The PrintManager object.

Remarks

When a Windows Store app registers its "intention" to print, it creates a print contract with the Print Manager. Here is a JavaScript code snippet to show how the GetForCurrentView method is used in registering for a print contract:


    var app = WinJS.Application;

    // This function responds to all application activations.
    app.onactivated = function (eventObject) {
        if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
           
            //Register for print contract
            var printManager = Windows.Graphics.Printing.PrintManager.getForCurrentView();
            printManager.onprinttaskrequested = onPrintTaskRequested;
        
            WinJS.UI.processAll();
        }
    };


For more examples involving GetForCurrentView, and to see some sample code for printing scenarios in Windows Store apps, see Printing in the Dev Center.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Graphics.Printing
Windows::Graphics::Printing [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

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

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

None supported

Namespace

Windows.Graphics.Printing
Windows::Graphics::Printing [C++]

Metadata

Windows.winmd

See also

Authoring a Windows Store device app for Printers
Printing
PrintManager

 

 

Show:
© 2015 Microsoft