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
public final class AnnotationDocumentPaginator extends DocumentPaginator
public final class AnnotationDocumentPaginator extends DocumentPaginator
You cannot use this managed 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 the DocumentViewer 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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions