Windows desktop applications
Collapse the table of content
Expand the table of content
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

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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Graphics.Printing
Windows::Graphics::Printing [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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