PrintManager PrintManager PrintManager PrintManager PrintManager Class


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

public : sealed class PrintManager : IPrintManager
struct winrt::Windows::Graphics::Printing::PrintManager : IPrintManager
public sealed class PrintManager : IPrintManager
Public NotInheritable Class PrintManager Implements IPrintManager
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The PrintManager class is responsible for orchestrating the printing flow for UWP app. 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.

When a UWP app registers its "intention" to print, it creates a print contract with the print manager. Here is a JavaScript code snippet to show how to register your app for a print contract using a PrintManager:

    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;


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


GetForCurrentView() GetForCurrentView() GetForCurrentView() GetForCurrentView() GetForCurrentView()

Retrieves the PrintManager object associated with the current window.

public : static PrintManager GetForCurrentView()
PrintManager GetForCurrentView() const;
public static PrintManager GetForCurrentView()
Public Static Function GetForCurrentView() As PrintManager
var printManager = Windows.Graphics.Printing.PrintManager.getForCurrentView();
See Also

IsSupported() IsSupported() IsSupported() IsSupported() IsSupported()

Indicates whether or not the app is running on a device that supports printing.

public : static Platform::Boolean IsSupported()
bool IsSupported() const;
public static bool IsSupported()
Public Static Function IsSupported() As bool
var bool = Windows.Graphics.Printing.PrintManager.isSupported();
bool bool bool

Returns true if on a device that supports printing, returns false if not.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)


A Universal Windows app should use this method to determine whether to show or hide certain UI elements related to the printing task.

ShowPrintUIAsync() ShowPrintUIAsync() ShowPrintUIAsync() ShowPrintUIAsync() ShowPrintUIAsync()

Programmatically initiates the user interface for printing content.

public : static IAsyncOperation<Platform::Boolean> ShowPrintUIAsync()
IAsyncOperation<bool> ShowPrintUIAsync() const;
public static IAsyncOperation<bool> ShowPrintUIAsync()
Public Static Function ShowPrintUIAsync() As IAsyncOperation( Of bool )
Windows.Graphics.Printing.PrintManager.showPrintUIAsync().done( /* Your success and error handlers */ );

A Boolean value to indicate a TRUE for success or a FALSE for a failure.


This method may be used by an application which has already used GetForCurrentView to retrieve the PrintManager instance 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 the app is to provide guidance for users to help users complete a printing-related process. For example, guidance at the end of a ticket purchasing process, or after checking in for a flight, and then printing a boarding pass.

ShowPrintUIAsync displays the appropriate printing window. If printing can't be performed at that time, the method will throw an exception. We recommend catching these exceptions and letting the user know when printing can't proceed, as shown here.

async private void printButton_Click(object sender, RoutedEventArgs e)
        // Show print UI
        await Windows.Graphics.Printing.PrintManager.ShowPrintUIAsync();

        // Printing cannot proceed at this time
        ContentDialog noPrintingDialog = new ContentDialog()
            Title = "Printing error",
            Content = "\nSorry, printing can't proceed at this time.", PrimaryButtonText = "OK"
        await noPrintingDialog.ShowAsync();

In this example, a print window is displayed in the event handler for a button click. If the method throws an exception (because printing can't be performed at that time), a ContentDialog control informs the user of the situation. For more info about printing from your app, see Printing.

See Also


PrintTaskRequested PrintTaskRequested PrintTaskRequested PrintTaskRequested 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.

public : event TypedEventHandler PrintTaskRequested<PrintManager, PrintTaskRequestedEventArgs>
// Register
event_token PrintTaskRequested(TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> const& handler) const;

// Revoke with event_token
void PrintTaskRequested(event_token const& cookie) const;

// Revoke with event_revoker
PrintTaskRequested_revoker PrintTaskRequested(auto_revoker_t, TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> const& handler) const;
public event TypedEventHandler PrintTaskRequested<PrintManager, PrintTaskRequestedEventArgs>
Public Event TypedEventHandler PrintTaskRequested( Of ( Of PrintManager ), ( Of PrintTaskRequestedEventArgs ))
function onPrintTaskRequested(eventArgs){/* Your code */}

printManager.addEventListener("printTaskRequested", onPrintTaskRequested);
printManager.removeEventListener("printTaskRequested", onPrintTaskRequested);


When you add print capabilities to your UWP app, you have to implement an event handler to process this event when it is raised. Here is a JavaScript code snippet that shows how to handle this event:

// Print event handler for printing via the PrintManager API.
// printEvent contains the print task request object
    function onPrintTaskRequested(printEvent) {    
        var printTask = printEvent.request.createPrintTask("Print Sample", function (args) {

To see the complete listing for this and other printing scenarios using PrintTaskRequested, see Printing.

See Also

See Also