AnnotationDocumentPaginator 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供 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 。
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 以將使用者批註新增至頁面以進行列印。
建構函式
屬性
IsPageCountValid |
取得值,這個值表示 PageCount 是否為頁面總數。 |
PageCount |
取得值,這個值表示目前已格式化的頁面數量。 |
PageSize |
取得或設定每個頁面的建議寬度和高度。 |
Source |
取得要分頁的來源文件。 |
方法
事件
ComputePageCountCompleted |
發生於 ComputePageCountAsync 作業已經完成時。 (繼承來源 DocumentPaginator) |
GetPageCompleted |
在 GetPageAsync 完成時發生。 (繼承來源 DocumentPaginator) |
PagesChanged |
文件內容變更後發生。 (繼承來源 DocumentPaginator) |