AnnotationDocumentPaginator Classe

Definição

Fornece um DocumentPaginator para imprimir um documento juntamente com as suas anotações associadas.

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
Herança
AnnotationDocumentPaginator

Exemplos

O exemplo seguinte mostra o uso da AnnotationDocumentPaginator classe.

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

Observações

A AnnotationDocumentPaginator classe envolve o DocumentPaginator especificado no AnnotationDocumentPaginator construtor para adicionar as anotações do utilizador às páginas para impressão.

Construtores

Name Description
AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

Inicializa uma nova instância da AnnotationDocumentPaginator classe com base num especificado DocumentPaginator, AnnotationStore, e texto FlowDirection.

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

Inicializa uma nova instância da AnnotationDocumentPaginator classe com base num especificado DocumentPaginator e AnnotationStore.

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

Inicializa uma nova instância da AnnotationDocumentPaginator classe com base num especificado DocumentPaginator, armazenamento Streamde anotações , e texto FlowDirection.

AnnotationDocumentPaginator(DocumentPaginator, Stream)

Inicializa uma nova instância da AnnotationDocumentPaginator classe com base num armazenamento Streamespecificado DocumentPaginator e de anotação .

Propriedades

Name Description
IsPageCountValid

Obtém um valor que indica se PageCount é o número total de páginas.

PageCount

Recebe um valor que indica o número de páginas atualmente formatadas.

PageSize

Obtém ou define a largura e altura sugeridas de cada página.

Source

Recebe o documento de origem que está a ser paginado.

Métodos

Name Description
CancelAsync(Object)

Cancela todas as operações assíncronas iniciadas com um dado userState objeto.

ComputePageCount()

Força a paginação do conteúdo, atualiza PageCount com o novo total e define IsPageCountValid para true.

ComputePageCountAsync()

Assíncronamente, força a paginação do conteúdo, atualiza PageCount com o novo total e define IsPageCountValid para true.

(Herdado de DocumentPaginator)
ComputePageCountAsync(Object)

Inicia uma paginação assíncrona do conteúdo, atualiza PageCount com o novo total e define IsPageCountValid para true quando está concluído.

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como função de hash predefinida.

(Herdado de Object)
GetPage(Int32)

Devolve a DocumentPage juntamente com as anotações de utilizador associadas para um número de página especificado.

GetPageAsync(Int32, Object)

Devolve assíncronamente a DocumentPage juntamente com as anotações de utilizador associadas para um número de página especificado.

GetPageAsync(Int32)

Devolve assíncronamente (através do GetPageCompleted evento) o DocumentPage para o número de página especificado.

(Herdado de DocumentPaginator)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do atual Object.

(Herdado de Object)
OnComputePageCountCompleted(AsyncCompletedEventArgs)

Eleva o ComputePageCountCompleted evento.

(Herdado de DocumentPaginator)
OnGetPageCompleted(GetPageCompletedEventArgs)

Eleva o GetPageCompleted evento.

(Herdado de DocumentPaginator)
OnPagesChanged(PagesChangedEventArgs)

Eleva o PagesChanged evento.

(Herdado de DocumentPaginator)
ToString()

Devolve uma cadeia que representa o objeto atual.

(Herdado de Object)

evento

Name Description
ComputePageCountCompleted

Ocorre quando uma ComputePageCountAsync operação termina.

(Herdado de DocumentPaginator)
GetPageCompleted

Ocorre quando GetPageAsync está concluído.

(Herdado de DocumentPaginator)
PagesChanged

Ocorre quando o conteúdo do documento é alterado.

(Herdado de DocumentPaginator)

Aplica-se a