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

注解

AnnotationDocumentPaginator 类将 DocumentPaginator 指定的 AnnotationDocumentPaginator 构造函数包装为要打印的页面添加用户批注。

构造函数

名称 说明
AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

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

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

AnnotationDocumentPaginator基于指定的DocumentPaginatorAnnotationStore

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

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

AnnotationDocumentPaginator(DocumentPaginator, Stream)

根据指定的AnnotationDocumentPaginator和批注存储DocumentPaginator初始化类的新实例Stream

属性

名称 说明
IsPageCountValid

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

PageCount

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

PageSize

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

Source

获取正在分页的源文档。

方法

名称 说明
CancelAsync(Object)

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

ComputePageCount()

强制对内容进行分页,使用新总数进行更新 PageCount ,并将其设置为 IsPageCountValidtrue

ComputePageCountAsync()

以异步方式强制对内容进行分页、使用新总数进行更新 PageCount 并设置为 IsPageCountValidtrue

(继承自 DocumentPaginator)
ComputePageCountAsync(Object)

启动内容的异步分页,使用新总数进行更新PageCount,并在完成时设置IsPageCountValidtrue

Equals(Object)

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

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetPage(Int32)

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

GetPageAsync(Int32, Object)

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

GetPageAsync(Int32)

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

(继承自 DocumentPaginator)
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)

适用于