This documentation is archived and is not being maintained.

AnnotationDocumentPaginator Class

Provides a DocumentPaginator for printing a document together with its associated annotations.

Namespace:  System.Windows.Annotations
Assembly:  PresentationFramework (in PresentationFramework.dll)

public sealed class AnnotationDocumentPaginator : DocumentPaginator
You cannot directly create an instance of this class in XAML.

The AnnotationDocumentPaginator class wraps the DocumentPaginator specified to the AnnotationDocumentPaginator constructor to add the user annotations to the pages for printing.

The following example shows use of the AnnotationDocumentPaginator class. For the full sample, see theDocumentViewer with Annotations XPS-Store Sample.

PrintDialog prntDialog = new PrintDialog();
if ((bool)prntDialog.ShowDialog())
    // XpsDocumentWriter.Write() may change the current 
    // directory to "My Documents" or another user selected
    // directory for storing the print document.  Save the 
    // current directory and restore it after calling Write().
    string docDir = Directory.GetCurrentDirectory();

    // Create and XpsDocumentWriter for the selected printer.
    XpsDocumentWriter xdw = PrintQueue.CreateXpsDocumentWriter(

    // Print the document with annotations. 
    catch (PrintingCanceledException)
        // If in the PrintDialog the user chooses a file-based 
        // output, such as the "MS Office Document Image Writer",
        // the user confirms or specifies the actual output 
        // filename when the xdw.write operation executes. 
        // If the user clicks "Cancel" in the filename
        // dialog a PrintingCanceledException is thrown 
        // which we catch here and ignore. 
        // MessageBox.Show("Print output cancelled");

    // Restore the original document directory to "current".
// ------------------ GetAnnotationDocumentPaginator ------------------ 
/// <summary> 
///   Returns a paginator for printing annotations.</summary> 
/// <param name="fds">
///   The FixedDocumentSequence containing 
///   the annotations to print.</param> 
/// <returns> 
///   An paginator for printing the document's annotations.</returns> 
public AnnotationDocumentPaginator GetAnnotationDocumentPaginator(
                                            FixedDocumentSequence fds)
    return new AnnotationDocumentPaginator(
                   fds.DocumentPaginator, _annotService.Store);


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0