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.

PrintTaskRequest.CreatePrintTask | createPrintTask method

Applies to Windows only

Creates a new PrintTask which indicates that the app has content to be printed.

Syntax


var printTask = printTaskRequest.createPrintTask(title, handler);

Parameters

title

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

Title for the print task.

handler

Type: PrintTaskSourceRequestedHandler

Pointer to a PrintTaskSourceRequestedHandler delegate for the print task.

Return value

Type: PrintTask

Pointer to the print task that was created.

Remarks

CreatePrintTask is used to create the print task, and here is a JavaScript code snippet to show how you would create a print task:


    // Print event handler for printing via the PrintManager API.
    // printEvent contains the print task request object
    function onPrintTaskRequested(printEvent) {
        printEvent.request.createPrintTask("Print Sample", function (args) {
            args.setSource(MSApp.getHtmlPrintDocumentSource(document));
        }); 
    }

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

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

Printing
PrintTask
PrintTaskRequest
PrintTaskSourceRequestedHandler

 

 

Show:
© 2014 Microsoft