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)

適用於