Changing Default Options

Once you create a PrintTask inside the handler for PrintTaskRequested, you can override its default options via its Options property of type PrintTaskOptions. For example, the following addition changes the default page orientation to landscape instead of portrait:

void OnPrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs args) {   // This is invoked when the Print pane opens   PrintTask task = args.Request.CreatePrintTask("Document Title",     async (taskArgs) =>     {       ...     });   task.Options.Orientation = PrintOrientation.Landscape; }

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.