C# Class PrintSample.DisablePreviewPrintHelper

This class customizes the standard PrintHelper in order to disable print preview.
The PrintTaskRequestedMethod sets printTask.IsPreviewEnabled to false in order to disable print preview. Since print preview is disabled, the Paginate event will not be raised. Instead, the pages to be printed are generated in response to the AddPages event.
Inheritance: PrintSample.PrintHelper
Mostrar archivo Open project: unoplatform/Uno.Windows-universal-samples Class Usage Examples

Public Methods

Method Description
DisablePreviewPrintHelper ( PrintSample.Page scenarioPage ) : SDKTemplate

Protected Methods

Method Description
AddOnePrintPage ( RichTextBlockOverflow lastRTBOAdded, PrintPageDescription printPageDescription ) : RichTextBlockOverflow

This function creates and adds one print page to the internal cache of print pages pages stored in printPages.

AddPrintPages ( object sender, AddPagesEventArgs e ) : void

This is the event handler for PrintDocument.AddPages. It provides all pages to be printed, in the form of UIElements, to an instance of PrintDocument. PrintDocument subsequently converts the UIElements into a pages that the Windows print system can deal with.

PrintTaskRequested ( PrintManager sender, PrintTaskRequestedEventArgs e ) : void

This is the event handler for PrintManager.PrintTaskRequested. In order to ensure a good user experience, the system requires that the app handle the PrintTaskRequested event within the time specified by PrintTaskRequestedEventArgs.Request.Deadline. Therefore, we use this handler to only create the print task. The print settings customization can be done when the print document source is requested.

Method Details

AddOnePrintPage() protected method

This function creates and adds one print page to the internal cache of print pages pages stored in printPages.
protected AddOnePrintPage ( RichTextBlockOverflow lastRTBOAdded, PrintPageDescription printPageDescription ) : RichTextBlockOverflow
lastRTBOAdded RichTextBlockOverflow Last RichTextBlockOverflow element added in the current content
printPageDescription PrintPageDescription Printer's page description
return RichTextBlockOverflow

AddPrintPages() protected method

This is the event handler for PrintDocument.AddPages. It provides all pages to be printed, in the form of UIElements, to an instance of PrintDocument. PrintDocument subsequently converts the UIElements into a pages that the Windows print system can deal with.
protected AddPrintPages ( object sender, AddPagesEventArgs e ) : void
sender object PrintDocument
e AddPagesEventArgs Add page event arguments containing a print task options reference
return void

DisablePreviewPrintHelper() public method

public DisablePreviewPrintHelper ( PrintSample.Page scenarioPage ) : SDKTemplate
scenarioPage PrintSample.Page
return SDKTemplate

PrintTaskRequested() protected method

This is the event handler for PrintManager.PrintTaskRequested. In order to ensure a good user experience, the system requires that the app handle the PrintTaskRequested event within the time specified by PrintTaskRequestedEventArgs.Request.Deadline. Therefore, we use this handler to only create the print task. The print settings customization can be done when the print document source is requested.
protected PrintTaskRequested ( PrintManager sender, PrintTaskRequestedEventArgs e ) : void
sender PrintManager PrintManager
e PrintTaskRequestedEventArgs PrintTaskRequestedEventArgs
return void