AnnotationDocumentPaginator Klass
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Tillhandahåller en DocumentPaginator för att skriva ut ett dokument tillsammans med tillhörande anteckningar.
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
- Arv
Exempel
I följande exempel visas hur klassen används AnnotationDocumentPaginator .
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
Kommentarer
Klassen AnnotationDocumentPaginator omsluter den DocumentPaginator angivna till AnnotationDocumentPaginator konstruktorn för att lägga till användarkommentarerna på sidorna för utskrift.
Konstruktorer
| Name | Description |
|---|---|
| AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection) |
Initierar en ny instans av AnnotationDocumentPaginator klassen baserat på en angiven DocumentPaginator, AnnotationStoreoch text FlowDirection. |
| AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore) |
Initierar en ny instans av AnnotationDocumentPaginator klassen baserat på en angiven DocumentPaginator och AnnotationStore. |
| AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection) |
Initierar en ny instans av AnnotationDocumentPaginator klassen baserat på en angiven DocumentPaginator, anteckningslagring Streamoch text FlowDirection. |
| AnnotationDocumentPaginator(DocumentPaginator, Stream) |
Initierar en ny instans av AnnotationDocumentPaginator klassen baserat på en angiven DocumentPaginator anteckningslagring Stream. |
Egenskaper
| Name | Description |
|---|---|
| IsPageCountValid |
Hämtar ett värde som anger om PageCount är det totala antalet sidor. |
| PageCount |
Hämtar ett värde som anger antalet sidor som för närvarande är formaterade. |
| PageSize |
Hämtar eller anger den föreslagna bredden och höjden på varje sida. |
| Source |
Hämtar källdokumentet som sidnumreras. |
Metoder
| Name | Description |
|---|---|
| CancelAsync(Object) |
Avbryter alla asynkrona åtgärder som initieras med ett visst |
| ComputePageCount() |
Tvingar fram en sidnumrering av innehållet, uppdateras PageCount med den nya summan och anger IsPageCountValid till |
| ComputePageCountAsync() |
Asynkront tvingar fram en sidnumrering av innehållet, uppdaterar PageCount med den nya summan och anger IsPageCountValid till |
| ComputePageCountAsync(Object) |
Startar en asynkron sidnumrering av innehållet, uppdaterar PageCount med den nya summan och anger IsPageCountValid när |
| Equals(Object) |
Avgör om det angivna objektet är lika med det aktuella objektet. (Ärvd från Object) |
| GetHashCode() |
Fungerar som standard-hash-funktion. (Ärvd från Object) |
| GetPage(Int32) |
Returnerar en DocumentPage tillsammans med associerade användaranteckningar för ett angivet sidnummer. |
| GetPageAsync(Int32, Object) |
Asynkront returnerar en DocumentPage tillsammans med associerade användaranteckningar för ett angivet sidnummer. |
| GetPageAsync(Int32) |
Returnerar asynkront (via GetPageCompleted händelsen) DocumentPage för det angivna sidnumret. (Ärvd från DocumentPaginator) |
| GetType() |
Hämtar den aktuella instansen Type . (Ärvd från Object) |
| MemberwiseClone() |
Skapar en ytlig kopia av den aktuella Object. (Ärvd från Object) |
| OnComputePageCountCompleted(AsyncCompletedEventArgs) |
Genererar händelsen ComputePageCountCompleted . (Ärvd från DocumentPaginator) |
| OnGetPageCompleted(GetPageCompletedEventArgs) |
Genererar händelsen GetPageCompleted . (Ärvd från DocumentPaginator) |
| OnPagesChanged(PagesChangedEventArgs) |
Genererar händelsen PagesChanged . (Ärvd från DocumentPaginator) |
| ToString() |
Returnerar en sträng som representerar det aktuella objektet. (Ärvd från Object) |
Händelser
| Name | Description |
|---|---|
| ComputePageCountCompleted |
Inträffar när en ComputePageCountAsync åtgärd har slutförts. (Ärvd från DocumentPaginator) |
| GetPageCompleted |
Inträffar när GetPageAsync har slutförts. (Ärvd från DocumentPaginator) |
| PagesChanged |
Inträffar när dokumentinnehållet ändras. (Ärvd från DocumentPaginator) |