PrintDocument PrintDocument PrintDocument Class


Defines a reusable object that sends output to a printer.

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


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.


PrintDocument() PrintDocument() PrintDocument()

Initializes a new instance of the PrintDocument class.

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


Dispatcher Dispatcher Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

(Inherited from DependencyObject)

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
IPrintDocumentSource IPrintDocumentSource IPrintDocumentSource

An object representing the document source.

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
DependencyProperty DependencyProperty DependencyProperty

The identifier for the DocumentSource dependency property.


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
UIElement UIElement UIElement

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

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

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Clears the local value of a dependency property.

(Inherited from DependencyObject)

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

(Inherited from DependencyObject)

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Returns the current effective value of a dependency property from a DependencyObject.

(Inherited from DependencyObject)

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

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if a local value is set.

(Inherited from DependencyObject)

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

(Inherited from DependencyObject)

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
int Int32 Int32

The sequence number of the page to preview.

UIElement UIElement UIElement

The root visual object for the requested print page.

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
int Int32 Int32

The number of pages included in the preview.

PreviewPageCountType PreviewPageCountType PreviewPageCountType

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

See Also

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Sets the local value of a dependency property on a DependencyObject.

(Inherited from DependencyObject)

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

(Inherited from DependencyObject)


AddPages AddPages AddPages

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

public : event AddPagesEventHandler AddPages<>
public event AddPagesEventHandler AddPages<>
Public Event AddPagesEventHandler AddPages( Of )


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 GetPreviewPage<>
public event GetPreviewPageEventHandler GetPreviewPage<>
Public Event GetPreviewPageEventHandler GetPreviewPage( Of )


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 Paginate<>
public event PaginateEventHandler Paginate<>
Public Event PaginateEventHandler Paginate( Of )
See Also

See Also