PrintDocument PrintDocument PrintDocument Class

Defines a reusable object that sends output to a printer.

Syntax

Declaration

public class PrintDocumentpublic class PrintDocumentPublic Class PrintDocument

Inheritance Hierarchy

Remarks

@Windows.UI.Xaml.Printing.PrintDocument.#ctor 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 summary

Initializes a new instance of the PrintDocument class.

Properties summary

Gets a document source reference for this PrintDocument.

Identifies the DocumentSource dependency property.

Methods summary

Adds a XAML root visual element to the print list.

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

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

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

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

Events summary

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

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

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

Constructors

  • PrintDocument()
    PrintDocument()
    PrintDocument()
    PrintDocument()

    Initializes a new instance of the PrintDocument class.

    public PrintDocument()public PrintDocument()Public Function PrintDocument() As

Properties

  • DocumentSource
    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

    Property Value

  • DocumentSourceProperty
    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

    Property Value

Methods

  • AddPage(Windows.UI.Xaml.UIElement)
    AddPage(Windows.UI.Xaml.UIElement)
    AddPage(Windows.UI.Xaml.UIElement)
    AddPage(Windows.UI.Xaml.UIElement)

    Adds a XAML root visual element to the print list.

    public void AddPage(Windows.UI.Xaml.UIElement pageVisual)public void AddPage(Windows.UI.Xaml.UIElement pageVisual)Public Function AddPage(pageVisual As Windows.UI.Xaml.UIElement) As void

    Parameters

  • AddPagesComplete()
    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
  • InvalidatePreview()
    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
  • SetPreviewPage(System.Int32,Windows.UI.Xaml.UIElement)
    SetPreviewPage(System.Int32,Windows.UI.Xaml.UIElement)
    SetPreviewPage(System.Int32,Windows.UI.Xaml.UIElement)
    SetPreviewPage(System.Int32,Windows.UI.Xaml.UIElement)

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

    public void SetPreviewPage(System.Int32 pageNumber,Windows.UI.Xaml.UIElement pageVisual)public void SetPreviewPage(System.Int32 pageNumber,Windows.UI.Xaml.UIElement pageVisual)Public Function SetPreviewPage(pageNumber As System.Int32,pageVisual As Windows.UI.Xaml.UIElement) As void

    Parameters

    • pageNumber
      System.Int32
      System.Int32
      System.Int32

      The sequence number of the page to preview.

    • pageVisual

      The root visual object for the requested print page.

  • SetPreviewPageCount(System.Int32,Windows.UI.Xaml.Printing.PreviewPageCountType)
    SetPreviewPageCount(System.Int32,Windows.UI.Xaml.Printing.PreviewPageCountType)
    SetPreviewPageCount(System.Int32,Windows.UI.Xaml.Printing.PreviewPageCountType)
    SetPreviewPageCount(System.Int32,Windows.UI.Xaml.Printing.PreviewPageCountType)

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

    public void SetPreviewPageCount(System.Int32 count,Windows.UI.Xaml.Printing.PreviewPageCountType type)public void SetPreviewPageCount(System.Int32 count,Windows.UI.Xaml.Printing.PreviewPageCountType type)Public Function SetPreviewPageCount(count As System.Int32,type As Windows.UI.Xaml.Printing.PreviewPageCountType) As void

    Parameters

Events

  • AddPages
    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

    Remarks

    Provide Windows with printable pages by calling AddPage(Windows.UI.Xaml.UIElement) for each page to be printed. Pass a UIElement that is the printable content to the AddPage(Windows.UI.Xaml.UIElement) 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.

  • GetPreviewPage
    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

    Remarks

    In the handler for this event, call SetPreviewPage(System.Int32,Windows.UI.Xaml.UIElement) to set the requested page as the current print preview page.

  • Paginate
    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

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ComposableAttribute

Details

Assembly

Windows.UI.Xaml.Printing.dll