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 class

Applies to Windows only

Contains the request from the system to create a print task. This object is available from the PrintTaskRequestedEventArgs object passed to the PrintTaskRequested event.

Syntax


Public NotInheritable Class PrintTaskRequest

Attributes

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

Members

The PrintTaskRequest class has these types of members:

Methods

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

MethodDescription
CreatePrintTask Creates a new PrintTask which indicates that the app has content to be printed.
GetDeferral Retrieves the deferral object associated with the PrintTaskRequest.

 

Properties

The PrintTaskRequest class has these properties.

PropertyAccess typeDescription

Deadline

Read-onlyGets a DateTime value that indicates how long an app has to respond to the PrintTaskRequested event.

 

Remarks

The PrintTaskRequest class is used by an app to create a new PrintTask object. A PrintTask object is created in response to the PrintTaskRequested event and it indicates to the system that the app has content to be printed. When creating a PrintTask object using the CreatePrintTask method, the app must provide a name for the PrintTask and a PrintTaskSourceRequestedHandler event handler which is called when the content to be printed is required.

An app should do the minimum amount of work possible in the PrintTaskRequested event handler since only a short amount of time is provided for a response. Wherever possible, the app should simply create a PrintTask and delay any content initialization until the PrintTaskSourceRequestedHandler event handler is called.

If an app needs to perform an asynchronous operation during the PrintTaskRequested handler it must retrieve and use a PrintTaskRequestedDeferral object. Prior to the exit of the event handler, and typically before the asynchronous operation is started, the app must retrieve the PrintTaskRequestedDeferral object by calling the GetDeferral method of the PrintTaskRequest object. When the asynchronous operation completes, the app must call the Complete method of the PrintTaskRequestedDeferral object to signal that the print task request is complete. The call to the Complete method must occur before the Deadline is reached in order for the request to be accepted.

The CreatePrintTask method in PrintTaskRequest can be used to create the print task. 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 [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

Printing

 

 

Show:
© 2014 Microsoft