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.

PrintManager class

Applies to Windows only

Informs Windows that an application wishes to participate in printing. The PrintManager class is also used for programmatically initiating printing.

Syntax


var printManager = Windows.Graphics.Printing.PrintManager;

Attributes

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

Members

The PrintManager class has these types of members:

Events

The PrintManager class has these events.

EventDescription
PrintTaskRequested Raised when a request to print has occurred. This event may be triggered by user action or via programmatic invocation of printing via the ShowPrintUIAsync method.

 

Methods

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

MethodDescription
GetForCurrentView Retrieves the PrintManager object associated with the current window.
ShowPrintUIAsync Programattically initiates the user interface for printing content.

 

Remarks

The Print Manager is responsible for orchestrating the printing flow for Windows Store apps. To use this class, you must first call the GetForCurrentView method. This method returns the PrintManager object that is specific to the current active window. Next, you must add an event listener for the PrintTaskRequested event. This event is raised by the system when a user indicates the possibility of initiating a printing operation. Typically this occurs when the user taps the Devices charm, but the event may also be invoked programmatically.

The PrintManager class also includes the ShowPrintUIAsync method. This method may be used by an application which has already used GetForCurrentView to retrieve the PrintManager and has registered a listener for the PrintTaskRequested event to initiate the printing user experience. In general applications are encouraged to let users print content via the Devices charm. For this reason, using the ShowPrintUIAsync method is discouraged. ShowPrintUIAsync is provided mainly for scenarios in which you want to provide guidance for users to help them complete a printing-related oricess. For example, guidance at the end of a ticket purchasing process, or after checking in for a flight, and then printing a boarding pass.

Here is a JavaScript code snippet to show how to register your app 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 the Print Manager, 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 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

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
Developing v4 Print Drivers
Printing

 

 

Show:
© 2014 Microsoft