Class PrintHelper

A helper class for printing. See the Catalog app for an example how to use it.

Inheritance
System.Object
PrintHelper
Namespace: PSPDFKit
Assembly: PSPDFKit.dll
Syntax
public sealed class PrintHelper

Constructors

PrintHelper(Document, Page, String, String)

Initialize the PrintHelper from a Page containing a named Canvas UIElement Will throw an Exception if the Document is null, a document is not open or a Canvas with the given name cannot be found in the Page.

Declaration
public PrintHelper(Document document, Page owningPage, string canvasName, string printJobDescription)
Parameters
Type Name Description
Document document

The Document holding the open document to be printed

Windows.UI.Xaml.Controls.Page owningPage

The Windows.UI.Xaml.Controls.Page owning the print task

System.String canvasName

The name of a Windows.UI.Xaml.Controls.Canvas on the Page that can be used by the PrintHelper to contain UIElements to be printed

System.String printJobDescription

The description of the print job displayed by the system printing dialog.

Properties

PrintMediaSize

Specifies the default selected print media size.

Declaration
public PrintMediaSize PrintMediaSize { get; set; }
Property Value
Type Description
Windows.Graphics.Printing.PrintMediaSize

Watermark

A watermark to place on the printed page.

Declaration
public Watermark Watermark { get; set; }
Property Value
Type Description
Watermark

Methods

CreatePrintHelperFromSourceAsync(DocumentSource, Page, String, String)

Creates the PrintHelper from a Page containing a named Canvas UIElement. The document will be opened from the documentSource. Will throw an Exception if the documentSource is invalid or a Canvas with the given name cannot be found in the Page.

Declaration
public static IAsyncOperation<PrintHelper> CreatePrintHelperFromSourceAsync(DocumentSource documentSource, Page owningPage, string canvasName, string printJobDescription)
Parameters
Type Name Description
DocumentSource documentSource

The DocumentSource holding the source document to be printed

Windows.UI.Xaml.Controls.Page owningPage

The Windows.UI.Xaml.Controls.Page owning the print task

System.String canvasName

The name of a Windows.UI.Xaml.Controls.Canvas on the Page that can be used by the PrintHelper to contain UIElements to be printed

System.String printJobDescription

The description of the print job displayed by the system printing dialog.

Returns
Type Description
Windows.Foundation.IAsyncOperation<PrintHelper>

ShowPrintUIAsync()

Show the Printing Dialog. If printing can't be performed, this method will throw an exception.

Declaration
public IAsyncOperation<bool> ShowPrintUIAsync()
Returns
Type Description
Windows.Foundation.IAsyncOperation<System.Boolean>

Events

PrintingCompleteHandler

Invoked when the print task completes.

Declaration
public event TypedEventHandler<PrintHelper, PrintTaskCompletedEventArgs> PrintingCompleteHandler
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PrintHelper, Windows.Graphics.Printing.PrintTaskCompletedEventArgs>