PrintManager.GetForCurrentView | getForCurrentView method

Applies to Windows only

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

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:
© 2014 Microsoft