PrintManager.PrintTaskRequested PrintManager.PrintTaskRequested PrintManager.PrintTaskRequested PrintManager.PrintTaskRequested PrintManager.PrintTaskRequested Event

Definition

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<PrintManager, PrintTaskRequestedEventArgs> PrintTaskRequested
// 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_revoke_t, TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> const& handler) const;
public event TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> PrintTaskRequested
Public Event PrintTaskRequested As TypedEventHandler (Of PrintManager, PrintTaskRequestedEventArgs)
function onPrintTaskRequested(eventArgs){/* Your code */}


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

Remarks

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) {
            args.setSource(MSApp.getHtmlPrintDocumentSource(document));
    });

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

See also