PrintTaskSourceRequestedHandler Delegate

Definition

Occurs when a print task requests the document to print. The supplied print document must implement the IPrintDocumentSource interface.

C#
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(1813028776, 23734, 19258, 134, 99, 243, 156, 176, 45, 201, 180)]
public delegate void PrintTaskSourceRequestedHandler(PrintTaskSourceRequestedArgs args);

Parameters

args
PrintTaskSourceRequestedArgs

Pointer to a PrintTaskSourceRequestedArgs object.

Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

The PrintTaskSourceRequestedHandler is called to complete the initialization of a PrintTask object. This two-phase initialization model is designed to enable an app to quickly respond to the PrintTaskRequested event by creating the PrintTask object. Then later, when printing is actually invoked, PrintTaskSourceRequestedHandler does the work required to prepare the content to be previewed and eventually printed. The deadline for completing work in the PrintTaskSourceRequestedHandler is much larger than the deadline for completing work in the PrintTaskRequested handler.

For example, consider an app that needs to download information from the Cloud to complete the printing operation for the details of a boarding pass. The app should respond quickly to the PrintTaskRequested event by creating a PrintTask object and a name for the print operation, for example "Fabrikam Boarding Pass." The app then provides PrintTaskSourceRequestedHandler with a pointer the PrintTask object. When this handler is invoked the app then initiates the call to retrieve the actual content of the boarding pass so that print preview and printing can be performed.

An app has two options for creating a print document source object:

  • Use a framework provided print document source. Both the HTML5/JavaScript and XAML frameworks provide implementations of objects which implement the IPrintDocumentSource interface. For HTML5/JavaScript apps see MSApp.getHtmlPrintDocumentSource. For information about developing print-capable apps with the extensible application markup language (XAML), see Windows.UI.Xaml.Printing.PrintDocument.
  • Provide a custom print document source. An app may choose to provide its own custom implementation of an IPrintDocumentSource object. Doing so requires a good understanding of Direct2D and/or the XPS APIs. For an example of how an app can provide its own custom print document source, see the D2D Printing sample.

Applies to

Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

See also