AnnotationDocumentPaginator Klasa

Definicja

Udostępnia element DocumentPaginator do drukowania dokumentu wraz z skojarzonymi adnotacjami.

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

Przykłady

W poniższym przykładzie pokazano użycie AnnotationDocumentPaginator klasy .

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

Uwagi

Klasa AnnotationDocumentPaginator opakowuje DocumentPaginator określony konstruktor w AnnotationDocumentPaginator celu dodania adnotacji użytkownika do stron drukowania.

Konstruktory

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

Inicjuje AnnotationDocumentPaginator nowe wystąpienie klasy na podstawie określonego DocumentPaginator i AnnotationStore.

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

Inicjuje AnnotationDocumentPaginator nowe wystąpienie klasy na podstawie określonego DocumentPaginator, AnnotationStorei tekstu FlowDirection.

AnnotationDocumentPaginator(DocumentPaginator, Stream)

Inicjuje AnnotationDocumentPaginator nowe wystąpienie klasy na podstawie określonego DocumentPaginator i adnotacji magazynu Stream.

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

Inicjuje AnnotationDocumentPaginator nowe wystąpienie klasy na podstawie określonego DocumentPaginatormagazynu Streamadnotacji i tekstu FlowDirection.

Właściwości

IsPageCountValid

Pobiera wartość wskazującą, czy PageCount jest to całkowita liczba stron.

PageCount

Pobiera wartość wskazującą liczbę aktualnie sformatowanych stron.

PageSize

Pobiera lub ustawia sugerowaną szerokość i wysokość każdej strony.

Source

Pobiera dokument źródłowy, który jest podzielony na strony.

Metody

CancelAsync(Object)

Anuluje wszystkie operacje asynchroniczne inicjowane przy użyciu danego userState obiektu.

ComputePageCount()

Wymusza stronicowanie zawartości, aktualizuje PageCount nową sumę i ustawia wartość IsPageCountValidtrue.

ComputePageCountAsync()

Asynchronicznie wymusza stronicowanie zawartości, aktualizuje PageCount nową sumę i ustawia wartość IsPageCountValidtrue.

(Odziedziczone po DocumentPaginator)
ComputePageCountAsync(Object)

Uruchamia asynchroniczne stronicowanie zawartości, aktualizuje PageCount ją wraz z nową sumą i ustawia IsPageCountValid na true wartość po zakończeniu.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetPage(Int32)

DocumentPage Zwraca element wraz z skojarzonymi adnotacjami użytkownika dla określonego numeru strony.

GetPageAsync(Int32)

Asynchronicznie zwraca wartość (za pośrednictwem GetPageCompleted zdarzenia) DocumentPage dla określonego numeru strony.

(Odziedziczone po DocumentPaginator)
GetPageAsync(Int32, Object)

Asynchronicznie zwraca DocumentPage adnotacje skojarzone z użytkownikami dla określonego numeru strony.

GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
OnComputePageCountCompleted(AsyncCompletedEventArgs)

ComputePageCountCompleted Zgłasza zdarzenie.

(Odziedziczone po DocumentPaginator)
OnGetPageCompleted(GetPageCompletedEventArgs)

GetPageCompleted Zgłasza zdarzenie.

(Odziedziczone po DocumentPaginator)
OnPagesChanged(PagesChangedEventArgs)

PagesChanged Zgłasza zdarzenie.

(Odziedziczone po DocumentPaginator)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Zdarzenia

ComputePageCountCompleted

Występuje po zakończeniu ComputePageCountAsync operacji.

(Odziedziczone po DocumentPaginator)
GetPageCompleted

Występuje po GetPageAsync zakończeniu.

(Odziedziczone po DocumentPaginator)
PagesChanged

Występuje, gdy zawartość dokumentu zostanie zmieniona.

(Odziedziczone po DocumentPaginator)

Dotyczy