AnnotationDocumentPaginator Clase

Definición

Proporciona un DocumentPaginator para imprimir un documento junto con sus anotaciones asociadas.

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

Ejemplos

En el ejemplo siguiente se muestra el uso de la AnnotationDocumentPaginator clase .

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

Comentarios

La AnnotationDocumentPaginator clase ajusta el DocumentPaginator especificado al AnnotationDocumentPaginator constructor para agregar las anotaciones de usuario a las páginas para imprimir.

Constructores

Nombre Description
AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

Inicializa una nueva instancia de la AnnotationDocumentPaginator clase basada en un texto DocumentPaginator, AnnotationStorey especificadoFlowDirection.

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

Inicializa una nueva instancia de la AnnotationDocumentPaginator clase basándose en un especificado DocumentPaginator y AnnotationStore.

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

Inicializa una nueva instancia de la AnnotationDocumentPaginator clase basada en un almacenamiento de anotaciones DocumentPaginatory texto StreamespecificadosFlowDirection.

AnnotationDocumentPaginator(DocumentPaginator, Stream)

Inicializa una nueva instancia de la AnnotationDocumentPaginator clase basándose en un almacenamiento DocumentPaginatorde anotación y especificadoStream.

Propiedades

Nombre Description
IsPageCountValid

Obtiene un valor que indica si PageCount es el número total de páginas.

PageCount

Obtiene un valor que indica el número de páginas con formato actual.

PageSize

Obtiene o establece el ancho sugerido y el alto de cada página.

Source

Obtiene el documento de origen que se está paginando.

Métodos

Nombre Description
CancelAsync(Object)

Cancela todas las operaciones asincrónicas iniciadas con un objeto determinado userState .

ComputePageCount()

Fuerza una paginación del contenido, actualiza PageCount con el nuevo total y establece en IsPageCountValidtrue.

ComputePageCountAsync()

De forma asincrónica, fuerza una paginación del contenido, actualiza PageCount con el nuevo total y establece en IsPageCountValidtrue.

(Heredado de DocumentPaginator)
ComputePageCountAsync(Object)

Inicia una paginación asincrónica del contenido, actualiza PageCount con el nuevo total y establece IsPageCountValid en true cuando finaliza.

Equals(Object)

Determina si el objeto especificado es igual al objeto actual.

(Heredado de Object)
GetHashCode()

Actúa como función hash predeterminada.

(Heredado de Object)
GetPage(Int32)

Devuelve un DocumentPage objeto junto con las anotaciones de usuario asociadas para un número de página especificado.

GetPageAsync(Int32, Object)

Devuelve de forma asincrónica un DocumentPage elemento junto con las anotaciones de usuario asociadas para un número de página especificado.

GetPageAsync(Int32)

Devuelve de forma asincrónica (a través del GetPageCompleted evento) el para DocumentPage el número de página especificado.

(Heredado de DocumentPaginator)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del Objectactual.

(Heredado de Object)
OnComputePageCountCompleted(AsyncCompletedEventArgs)

Genera el evento ComputePageCountCompleted.

(Heredado de DocumentPaginator)
OnGetPageCompleted(GetPageCompletedEventArgs)

Genera el evento GetPageCompleted.

(Heredado de DocumentPaginator)
OnPagesChanged(PagesChangedEventArgs)

Genera el evento PagesChanged.

(Heredado de DocumentPaginator)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Eventos

Nombre Description
ComputePageCountCompleted

Se produce cuando una ComputePageCountAsync operación ha finalizado.

(Heredado de DocumentPaginator)
GetPageCompleted

Se produce cuando GetPageAsync se ha completado.

(Heredado de DocumentPaginator)
PagesChanged

Se produce cuando se cambia el contenido del documento.

(Heredado de DocumentPaginator)

Se aplica a