共用方式為


AnnotationDocumentPaginator 建構函式

定義

初始化 AnnotationDocumentPaginator 類別的新執行個體。

多載

AnnotationDocumentPaginator(DocumentPaginator, Stream)

根據指定的 AnnotationDocumentPaginator 和附註儲存體 DocumentPaginator,初始化 Stream 類別的新執行個體。

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

根據指定的 AnnotationDocumentPaginatorDocumentPaginator,初始化 AnnotationStore 類別的新執行個體。

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

根據指定的 AnnotationDocumentPaginator、附註儲存體 DocumentPaginator 和文字 Stream,初始化 FlowDirection 類別的新執行個體。

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

根據指定的 AnnotationDocumentPaginatorDocumentPaginator 和文字 AnnotationStore,初始化 FlowDirection 類別的新執行個體。

備註

類別 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)

根據指定的 AnnotationDocumentPaginatorDocumentPaginator,初始化 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

文字流向,LeftToRightRightToLeft

備註

類別 AnnotationDocumentPaginator 會將 DocumentPaginator 指定的 包裝至建構函式, AnnotationDocumentPaginator 以將使用者批註新增至要列印的頁面。

適用於

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

根據指定的 AnnotationDocumentPaginatorDocumentPaginator 和文字 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

文字流向,LeftToRightRightToLeft

備註

類別 AnnotationDocumentPaginator 會將 DocumentPaginator 指定的 包裝至建構函式, AnnotationDocumentPaginator 以將使用者批註新增至要列印的頁面。

適用於