AnnotationDocumentPaginator Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Fournit un DocumentPaginator élément permettant d’imprimer un document avec ses annotations associées.
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
- Héritage
Exemples
L’exemple suivant montre l’utilisation de la 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
Remarques
La AnnotationDocumentPaginator classe encapsule le DocumentPaginatorAnnotationDocumentPaginator constructeur spécifié pour ajouter les annotations utilisateur aux pages à imprimer.
Constructeurs
| Nom | Description |
|---|---|
| AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection) |
Initialise une nouvelle instance de la AnnotationDocumentPaginator classe en fonction d’un texte et DocumentPaginatord’un texte AnnotationStorespécifiésFlowDirection. |
| AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore) |
Initialise une nouvelle instance de la AnnotationDocumentPaginator classe en fonction d’un élément spécifié DocumentPaginator et AnnotationStore. |
| AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection) |
Initialise une nouvelle instance de la AnnotationDocumentPaginator classe en fonction d’un stockage DocumentPaginatord’annotations et d’un texte StreamspécifiésFlowDirection. |
| AnnotationDocumentPaginator(DocumentPaginator, Stream) |
Initialise une nouvelle instance de la AnnotationDocumentPaginator classe en fonction d’un stockage DocumentPaginatord’annotation et spécifiéStream. |
Propriétés
| Nom | Description |
|---|---|
| IsPageCountValid |
Obtient une valeur qui indique si PageCount le nombre total de pages est indiqué. |
| PageCount |
Obtient une valeur qui indique le nombre de pages actuellement mises en forme. |
| PageSize |
Obtient ou définit la largeur et la hauteur suggérées de chaque page. |
| Source |
Obtient le document source en cours de paginé. |
Méthodes
| Nom | Description |
|---|---|
| CancelAsync(Object) |
Annule toutes les opérations asynchrones lancées avec un objet donné |
| ComputePageCount() |
Force une pagination du contenu, est mise à jour PageCount avec le nouveau total et définit IsPageCountValid |
| ComputePageCountAsync() |
De façon asynchrone, force la pagination du contenu, les mises à jour PageCount avec le nouveau total et les jeux IsPageCountValid sur |
| ComputePageCountAsync(Object) |
Démarre une pagination asynchrone du contenu, se met à jour PageCount avec le nouveau total et définit IsPageCountValid |
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetPage(Int32) |
Retourne un DocumentPage ensemble avec les annotations utilisateur associées pour un numéro de page spécifié. |
| GetPageAsync(Int32, Object) |
Retourne de façon asynchrone une DocumentPage combinaison d’annotations utilisateur associées pour un numéro de page spécifié. |
| GetPageAsync(Int32) |
Retourne de façon asynchrone (via l’événement GetPageCompleted ) le DocumentPage numéro de page spécifié. (Hérité de DocumentPaginator) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| OnComputePageCountCompleted(AsyncCompletedEventArgs) |
Déclenche l’événement ComputePageCountCompleted. (Hérité de DocumentPaginator) |
| OnGetPageCompleted(GetPageCompletedEventArgs) |
Déclenche l’événement GetPageCompleted. (Hérité de DocumentPaginator) |
| OnPagesChanged(PagesChangedEventArgs) |
Déclenche l’événement PagesChanged. (Hérité de DocumentPaginator) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |
Événements
| Nom | Description |
|---|---|
| ComputePageCountCompleted |
Se produit lorsqu’une ComputePageCountAsync opération est terminée. (Hérité de DocumentPaginator) |
| GetPageCompleted |
Se produit une fois GetPageAsync l’opération terminée. (Hérité de DocumentPaginator) |
| PagesChanged |
Se produit lorsque le contenu du document est modifié. (Hérité de DocumentPaginator) |