PrintTaskSourceRequestedArgs Class

Definition

Arguments associated with the PrintTaskSourceRequestedHandler delegate. Provides a method for handing the content to be printed to the PrintTask.

C#
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PrintTaskSourceRequestedArgs
Inheritance
Object PrintTaskSourceRequestedArgs
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

PrintTaskSourceRequestedArgs is used to set the source of the content to be printed. Here is a code snippet from the UWP print sample that shows the SetSource method:

C#
protected virtual void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs e)
{
    PrintTask printTask = null;
    printTask = e.Request.CreatePrintTask("C# Printing SDK Sample", sourceRequested =>
    {
        // Print Task event handler is invoked when the print job is completed.
        printTask.Completed += async (s, args) =>
        {
            // Notify the user when the print operation fails.
            if (args.Completion == PrintTaskCompletion.Failed)
            {
                await scenarioPage.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    MainPage.Current.NotifyUser("Failed to print.", NotifyType.ErrorMessage);
                });
            }
        };

        // Call PrintTaskSourceRequestedArgs.SetSource
        sourceRequested.SetSource(printDocumentSource);
    });
}

For more information on this and other printing scenarios, see Printing and the UWP print sample.

Properties

Deadline

Gets the DateTime object that indicates the deadline for a print task source request.

Methods

GetDeferral()

Gets a PrintTaskSourceRequestedDeferral object that provides access to a Complete method. This method indicates then the deferral is over.

SetSource(IPrintDocumentSource)

Informs the print task of the content to be printed.

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