Bagikan melalui


AnnotationDocumentPaginator Kelas

Definisi

DocumentPaginator Menyediakan untuk mencetak dokumen bersama dengan anotasi terkait.

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
Warisan
AnnotationDocumentPaginator

Contoh

Contoh berikut menunjukkan penggunaan AnnotationDocumentPaginator kelas .

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

Keterangan

Kelas AnnotationDocumentPaginator membungkus DocumentPaginator yang ditentukan ke AnnotationDocumentPaginator konstruktor untuk menambahkan anotasi pengguna ke halaman untuk pencetakan.

Konstruktor

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

Menginisialisasi instans AnnotationDocumentPaginator baru kelas berdasarkan yang ditentukan DocumentPaginator dan AnnotationStore.

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

Menginisialisasi instans AnnotationDocumentPaginator baru kelas berdasarkan teks FlowDirection, , AnnotationStoredan tertentu DocumentPaginator.

AnnotationDocumentPaginator(DocumentPaginator, Stream)

Menginisialisasi instans AnnotationDocumentPaginator baru kelas berdasarkan penyimpanan Streamyang ditentukan DocumentPaginator dan anotasi .

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

Menginisialisasi instans AnnotationDocumentPaginator baru kelas berdasarkan penyimpanan Stream, anotasi, dan teks FlowDirectiontertentuDocumentPaginator.

Properti

IsPageCountValid

Mendapatkan nilai yang menunjukkan apakah PageCount jumlah total halaman.

PageCount

Mendapatkan nilai yang menunjukkan jumlah halaman yang saat ini diformat.

PageSize

Mendapatkan atau mengatur lebar dan tinggi yang disarankan dari setiap halaman.

Source

Mendapatkan dokumen sumber yang sedang dipaginasi.

Metode

CancelAsync(Object)

Membatalkan semua operasi asinkron yang dimulai dengan objek tertentu userState .

ComputePageCount()

Memaksa penomoran halaman konten, memperbarui PageCount dengan total baru, dan mengatur IsPageCountValid ke true.

ComputePageCountAsync()

Secara asinkron, memaksa penomoran halaman konten, memperbarui PageCount dengan total baru, dan mengatur IsPageCountValid ke true.

(Diperoleh dari DocumentPaginator)
ComputePageCountAsync(Object)

Memulai paginasi konten asinkron, memperbarui PageCount dengan total baru, dan mengatur IsPageCountValid ke true ketika selesai.

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetPage(Int32)

DocumentPage Mengembalikan bersama dengan anotasi pengguna terkait untuk nomor halaman tertentu.

GetPageAsync(Int32)

Secara asinkron mengembalikan (melalui GetPageCompleted peristiwa) DocumentPage untuk nomor halaman yang ditentukan.

(Diperoleh dari DocumentPaginator)
GetPageAsync(Int32, Object)

Secara asinkron mengembalikan DocumentPage bersama dengan anotasi pengguna terkait untuk nomor halaman tertentu.

GetType()

Mendapatkan instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari yang saat ini Object.

(Diperoleh dari Object)
OnComputePageCountCompleted(AsyncCompletedEventArgs)

Memunculkan kejadian ComputePageCountCompleted.

(Diperoleh dari DocumentPaginator)
OnGetPageCompleted(GetPageCompletedEventArgs)

Memunculkan kejadian GetPageCompleted.

(Diperoleh dari DocumentPaginator)
OnPagesChanged(PagesChangedEventArgs)

Memunculkan kejadian PagesChanged.

(Diperoleh dari DocumentPaginator)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Acara

ComputePageCountCompleted

Terjadi ketika ComputePageCountAsync operasi telah selesai.

(Diperoleh dari DocumentPaginator)
GetPageCompleted

Terjadi ketika GetPageAsync telah selesai.

(Diperoleh dari DocumentPaginator)
PagesChanged

Terjadi ketika konten dokumen diubah.

(Diperoleh dari DocumentPaginator)

Berlaku untuk