AnnotationDocumentPaginator 类

定义

提供一个 DocumentPaginator,用于打印文档及其关联的批注。

public ref class AnnotationDocumentPaginator sealed : System::Windows::Documents::DocumentPaginator
public sealed class AnnotationDocumentPaginator : System.Windows.Documents.DocumentPaginator
type AnnotationDocumentPaginator = class
    inherit DocumentPaginator
Public NotInheritable Class AnnotationDocumentPaginator
Inherits DocumentPaginator
继承
AnnotationDocumentPaginator

示例

以下示例演示如何使用 AnnotationDocumentPaginator 类。

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(
                                        prntDialog.PrintQueue);

    // Print the document with annotations.
    try
    {
        xdw.Write(_annotHelper.GetAnnotationDocumentPaginator(
            _xpsDocument.GetFixedDocumentSequence()));
    }
    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".
    Directory.SetCurrentDirectory(docDir);
}
Dim prntDialog As New PrintDialog()
If CBool(prntDialog.ShowDialog()) Then
    ' 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().
    Dim docDir As String = Directory.GetCurrentDirectory()

    ' Create and XpsDocumentWriter for the selected printer.
    Dim xdw As XpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(prntDialog.PrintQueue)

    ' Print the document with annotations.
    Try
        xdw.Write(_annotHelper.GetAnnotationDocumentPaginator(_xpsDocument.GetFixedDocumentSequence()))
    Catch e1 As 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.
    End Try

    ' Restore the original document directory to "current".
    Directory.SetCurrentDirectory(docDir)
End If
// ------------------ 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);
}
' ------------------ 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 Function GetAnnotationDocumentPaginator(ByVal fds As FixedDocumentSequence) As AnnotationDocumentPaginator
    Return New AnnotationDocumentPaginator(fds.DocumentPaginator, _annotService.Store)
End Function

注解

AnnotationDocumentPaginatorDocumentPaginator 指定的 包装到构造函数中 AnnotationDocumentPaginator ,以便将用户注释添加到页面进行打印。

构造函数

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

基于指定的 AnnotationDocumentPaginatorDocumentPaginator 初始化 AnnotationStore 类的新实例。

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

基于指定的 AnnotationDocumentPaginatorDocumentPaginator 和文本 AnnotationStore 初始化 FlowDirection 类的新实例。

AnnotationDocumentPaginator(DocumentPaginator, Stream)

基于指定的 AnnotationDocumentPaginator 和批注存储 DocumentPaginator 初始化 Stream 类的新实例。

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

基于指定的 AnnotationDocumentPaginator、批注存储 DocumentPaginator 和文本 Stream 初始化 FlowDirection 类的新实例。

属性

IsPageCountValid

获取一个值,该值指示 PageCount 是否为总页数。

PageCount

获取一个值,该值指示当前设置了格式的页数。

PageSize

获取或设置每页的建议宽度和高度。

Source

获取正在分页的源文档。

方法

CancelAsync(Object)

取消使用给定 userState 对象启动的所有异步操作。

ComputePageCount()

强制对内容进行分页,用新的总页数更新 PageCount,并将 IsPageCountValid 设置为 true

ComputePageCountAsync()

通过异步方式强制对内容进行分页,用新的总页数更新 PageCount,并将 IsPageCountValid 设置为 true

(继承自 DocumentPaginator)
ComputePageCountAsync(Object)

启动内容的异步分页,使用新的总计更新 PageCount,然后在完成时将 IsPageCountValid 设置为 true

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetPage(Int32)

返回 DocumentPage 以及指定页码的关联用户批注。

GetPageAsync(Int32)

(通过 GetPageCompleted 事件)异步返回指定页码的 DocumentPage

(继承自 DocumentPaginator)
GetPageAsync(Int32, Object)

异步返回 DocumentPage 以及指定页码的关联用户批注。

GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnComputePageCountCompleted(AsyncCompletedEventArgs)

引发 ComputePageCountCompleted 事件。

(继承自 DocumentPaginator)
OnGetPageCompleted(GetPageCompletedEventArgs)

引发 GetPageCompleted 事件。

(继承自 DocumentPaginator)
OnPagesChanged(PagesChangedEventArgs)

引发 PagesChanged 事件。

(继承自 DocumentPaginator)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

事件

ComputePageCountCompleted

ComputePageCountAsync 操作完成时发生。

(继承自 DocumentPaginator)
GetPageCompleted

GetPageAsync 完成时发生。

(继承自 DocumentPaginator)
PagesChanged

在文档内容改变时发生。

(继承自 DocumentPaginator)

适用于