Print​Document Print​Document Print​Document Class

Definition

Defines a reusable object that sends output to a printer.

public : class PrintDocument : DependencyObject, IPrintDocumentpublic class PrintDocument : DependencyObject, IPrintDocumentPublic Class PrintDocument Inherits DependencyObject Implements IPrintDocument
Inheritance
PrintDocumentPrintDocumentPrintDocument
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Remarks

PrintDocument implements a print list concept whereby pages can be added to the print list, and then various methods can be called on the ongoing print list.

Constructors

PrintDocument() PrintDocument() PrintDocument()

Initializes a new instance of the PrintDocument class.

public : PrintDocument()public PrintDocument()Public Sub New()
Attributes

Properties

DocumentSource DocumentSource DocumentSource

Gets a document source reference for this PrintDocument.

public : IPrintDocumentSource DocumentSource { get; }public IPrintDocumentSource DocumentSource { get; }Public ReadOnly Property DocumentSource As IPrintDocumentSource
Value
IPrintDocumentSource IPrintDocumentSource IPrintDocumentSource

An object representing the document source.

Attributes

DocumentSourceProperty DocumentSourceProperty DocumentSourceProperty

Identifies the DocumentSource dependency property.

public : static DependencyProperty DocumentSourceProperty { get; }public static DependencyProperty DocumentSourceProperty { get; }Public Static ReadOnly Property DocumentSourceProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the DocumentSource dependency property.

Attributes

Methods

AddPage(UIElement) AddPage(UIElement) AddPage(UIElement)

Adds a XAML root visual element to the print list.

public : void AddPage(UIElement pageVisual)public void AddPage(UIElement pageVisual)Public Function AddPage(pageVisual As UIElement) As void
Parameters
pageVisual
UIElement UIElement UIElement

The root visual element of the page to add to the print list.

Attributes

AddPagesComplete() AddPagesComplete() AddPagesComplete()

Indicates that the application will not add more pages to the print list, and that the print list is ready to be released.

public : void AddPagesComplete()public void AddPagesComplete()Public Function AddPagesComplete() As void
Attributes

InvalidatePreview() InvalidatePreview() InvalidatePreview()

References the low-level print preview dialog API and invalidates the current print preview.

public : void InvalidatePreview()public void InvalidatePreview()Public Function InvalidatePreview() As void
Attributes

SetPreviewPage(Int32, UIElement) SetPreviewPage(Int32, UIElement) SetPreviewPage(Int32, UIElement)

Sets the specified print page as the current print preview page.

public : void SetPreviewPage(int pageNumber, UIElement pageVisual)public void SetPreviewPage(Int32 pageNumber, UIElement pageVisual)Public Function SetPreviewPage(pageNumber As Int32, pageVisual As UIElement) As void
Parameters
pageNumber
int Int32 Int32

The sequence number of the page to preview.

pageVisual
UIElement UIElement UIElement

The root visual object for the requested print page.

Attributes
See Also

SetPreviewPageCount(Int32, PreviewPageCountType) SetPreviewPageCount(Int32, PreviewPageCountType) SetPreviewPageCount(Int32, PreviewPageCountType)

Sets the number of pages prepared for print preview and added to the print list.

public : void SetPreviewPageCount(int count, PreviewPageCountType type)public void SetPreviewPageCount(Int32 count, PreviewPageCountType type)Public Function SetPreviewPageCount(count As Int32, type As PreviewPageCountType) As void
Parameters
count
int Int32 Int32

The number of pages included in the preview.

type
PreviewPageCountType PreviewPageCountType PreviewPageCountType

A value of the enumeration that specifies how to determine the page count.

Attributes
See Also

Events

AddPages AddPages AddPages

Occurs when the PrintManager requests the final collection of pages to send to the printer.

public : event AddPagesEventHandler AddPagespublic event AddPagesEventHandler AddPagesPublic Event AddPages
Attributes

Remarks

Provide Windows with printable pages by calling AddPage for each page to be printed. Pass a UIElement that is the printable content to the AddPage method. Call AddPagesComplete to signal that all of the pages to be printed have been added and Windows can continue with the print job.

If the user specifies particular pages or a range of pages in the print options UI, only the specified pages should be added to the print list.

See Also

GetPreviewPage GetPreviewPage GetPreviewPage

Occurs when the PrintManager requests a particular print page to be shown in the preview window.

public : event GetPreviewPageEventHandler GetPreviewPagepublic event GetPreviewPageEventHandler GetPreviewPagePublic Event GetPreviewPage
Attributes

Remarks

In the handler for this event, call SetPreviewPage to set the requested page as the current print preview page.

See Also

Paginate Paginate Paginate

Occurs when the PrintManager requests the collection of print pages to be shown in the preview window.

public : event PaginateEventHandler Paginatepublic event PaginateEventHandler PaginatePublic Event Paginate
Attributes
See Also

See Also