AnnotationDocumentPaginator 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 AnnotationDocumentPaginator 类的新实例。
重载
注解
该 AnnotationDocumentPaginator 类将 DocumentPaginator 指定的构造函数包装为 AnnotationDocumentPaginator 要打印的页面添加用户批注。
AnnotationDocumentPaginator(DocumentPaginator, Stream)
基于指定的 AnnotationDocumentPaginator 和批注存储 DocumentPaginator 初始化 Stream 类的新实例。
public:
AnnotationDocumentPaginator(System::Windows::Documents::DocumentPaginator ^ originalPaginator, System::IO::Stream ^ annotationStore);
public AnnotationDocumentPaginator (System.Windows.Documents.DocumentPaginator originalPaginator, System.IO.Stream annotationStore);
new System.Windows.Annotations.AnnotationDocumentPaginator : System.Windows.Documents.DocumentPaginator * System.IO.Stream -> System.Windows.Annotations.AnnotationDocumentPaginator
Public Sub New (originalPaginator As DocumentPaginator, annotationStore As Stream)
参数
- originalPaginator
- DocumentPaginator
要添加打印批注的文档。
- annotationStore
- Stream
要从中检索批注的批注存储流。
注解
默认情况下,此构造函数将文本流方向设置为 LeftToRight。 如果需要,可以使用某个备用 AnnotationDocumentPaginator 构造函数重载将文本 FlowDirection 设置为其他设置。
该 AnnotationDocumentPaginator 类将 DocumentPaginator 指定的构造函数包装为 AnnotationDocumentPaginator 要打印的页面添加用户批注。
适用于
AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)
基于指定的 AnnotationDocumentPaginator 和 DocumentPaginator 初始化 AnnotationStore 类的新实例。
public:
AnnotationDocumentPaginator(System::Windows::Documents::DocumentPaginator ^ originalPaginator, System::Windows::Annotations::Storage::AnnotationStore ^ annotationStore);
public AnnotationDocumentPaginator (System.Windows.Documents.DocumentPaginator originalPaginator, System.Windows.Annotations.Storage.AnnotationStore annotationStore);
new System.Windows.Annotations.AnnotationDocumentPaginator : System.Windows.Documents.DocumentPaginator * System.Windows.Annotations.Storage.AnnotationStore -> System.Windows.Annotations.AnnotationDocumentPaginator
Public Sub New (originalPaginator As DocumentPaginator, annotationStore As AnnotationStore)
参数
- originalPaginator
- DocumentPaginator
要添加打印批注的文档。
- annotationStore
- AnnotationStore
要从中检索批注的存储区。
示例
下面的示例演示了 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
注解
默认情况下,此构造函数将文本流方向设置为 LeftToRight。 如果需要,可以使用某个备用 AnnotationDocumentPaginator 构造函数重载将文本 FlowDirection 设置为其他设置。
该 AnnotationDocumentPaginator 类将 DocumentPaginator 指定的构造函数包装为 AnnotationDocumentPaginator 要打印的页面添加用户批注。
适用于
AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)
基于指定的 AnnotationDocumentPaginator、批注存储 DocumentPaginator 和文本 Stream 初始化 FlowDirection 类的新实例。
public:
AnnotationDocumentPaginator(System::Windows::Documents::DocumentPaginator ^ originalPaginator, System::IO::Stream ^ annotationStore, System::Windows::FlowDirection flowDirection);
public AnnotationDocumentPaginator (System.Windows.Documents.DocumentPaginator originalPaginator, System.IO.Stream annotationStore, System.Windows.FlowDirection flowDirection);
new System.Windows.Annotations.AnnotationDocumentPaginator : System.Windows.Documents.DocumentPaginator * System.IO.Stream * System.Windows.FlowDirection -> System.Windows.Annotations.AnnotationDocumentPaginator
Public Sub New (originalPaginator As DocumentPaginator, annotationStore As Stream, flowDirection As FlowDirection)
参数
- originalPaginator
- DocumentPaginator
要添加打印批注的文档。
- annotationStore
- Stream
要从中检索批注的批注存储流。
- flowDirection
- FlowDirection
文本流方向:LeftToRight 或 RightToLeft。
注解
该 AnnotationDocumentPaginator 类将 DocumentPaginator 指定的构造函数包装为 AnnotationDocumentPaginator 要打印的页面添加用户批注。
适用于
AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)
基于指定的 AnnotationDocumentPaginator、DocumentPaginator 和文本 AnnotationStore 初始化 FlowDirection 类的新实例。
public:
AnnotationDocumentPaginator(System::Windows::Documents::DocumentPaginator ^ originalPaginator, System::Windows::Annotations::Storage::AnnotationStore ^ annotationStore, System::Windows::FlowDirection flowDirection);
public AnnotationDocumentPaginator (System.Windows.Documents.DocumentPaginator originalPaginator, System.Windows.Annotations.Storage.AnnotationStore annotationStore, System.Windows.FlowDirection flowDirection);
new System.Windows.Annotations.AnnotationDocumentPaginator : System.Windows.Documents.DocumentPaginator * System.Windows.Annotations.Storage.AnnotationStore * System.Windows.FlowDirection -> System.Windows.Annotations.AnnotationDocumentPaginator
Public Sub New (originalPaginator As DocumentPaginator, annotationStore As AnnotationStore, flowDirection As FlowDirection)
参数
- originalPaginator
- DocumentPaginator
要添加打印批注的文档。
- annotationStore
- AnnotationStore
要从中检索批注的存储区。
- flowDirection
- FlowDirection
文本流方向:LeftToRight 或 RightToLeft。
注解
该 AnnotationDocumentPaginator 类将 DocumentPaginator 指定的构造函数包装为 AnnotationDocumentPaginator 要打印的页面添加用户批注。