Язык

AnnotationDocumentPaginator Класс

Определение

Предоставляет возможность DocumentPaginator печати документа вместе со связанными заметками.

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
Наследование
AnnotationDocumentPaginator

Примеры

В следующем примере показано использование 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

Комментарии

Класс AnnotationDocumentPaginator упаковывает DocumentPaginator указанный AnnotationDocumentPaginator конструктор, чтобы добавить заметки пользователя на страницы для печати.

Конструкторы

Имя Описание
AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore, FlowDirection)

Инициализирует новый экземпляр класса на основе указанного AnnotationDocumentPaginatorDocumentPaginatorи AnnotationStoreтекстового FlowDirectionэлемента.

AnnotationDocumentPaginator(DocumentPaginator, AnnotationStore)

Инициализирует новый экземпляр класса на основе указанного AnnotationDocumentPaginatorDocumentPaginator и AnnotationStore.

AnnotationDocumentPaginator(DocumentPaginator, Stream, FlowDirection)

Инициализирует новый экземпляр класса на основе указанного AnnotationDocumentPaginatorDocumentPaginatorхранилища заметок Streamи текста FlowDirection.

AnnotationDocumentPaginator(DocumentPaginator, Stream)

Инициализирует новый экземпляр класса на основе указанного AnnotationDocumentPaginatorDocumentPaginator хранилища заметок Stream.

Свойства

Имя Описание
IsPageCountValid

Возвращает значение, указывающее, является ли PageCount общее количество страниц.

PageCount

Возвращает значение, указывающее количество страниц, отформатированных в данный момент.

PageSize

Возвращает или задает рекомендуемую ширину и высоту каждой страницы.

Source

Возвращает исходный документ, который выполняется на страницы.

Методы

Имя Описание
CancelAsync(Object)

Отменяет все асинхронные операции, инициированные заданным userState объектом.

ComputePageCount()

Принудительно выполняет разбивку на страницы содержимого, обновляется PageCount с новым итогом и задает IsPageCountValid значение true.

ComputePageCountAsync()

Асинхронно принудительно выполняет разбиение на страницы содержимого, обновляется PageCount с новым итогом и задает IsPageCountValid значение true.

(Унаследовано от DocumentPaginator)
ComputePageCountAsync(Object)

Запускает асинхронную разбивку на страницы содержимого, обновляется PageCount с новым итогом и задает IsPageCountValid значение true после завершения.

Equals(Object)

Определяет, равен ли указанный объект текущему объекту.

(Унаследовано от Object)
GetHashCode()

Служит хэш-функцией по умолчанию.

(Унаследовано от Object)
GetPage(Int32)

DocumentPage Возвращает вместе с связанными заметками пользователя для указанного номера страницы.

GetPageAsync(Int32, Object)

Асинхронно возвращается DocumentPage вместе с связанными пользовательскими заметками для указанного номера страницы.

GetPageAsync(Int32)

Асинхронно возвращает (через событие) GetPageCompleted указанный DocumentPage номер страницы.

(Унаследовано от DocumentPaginator)
GetType()

Возвращает Type текущего экземпляра.

(Унаследовано от Object)
MemberwiseClone()

Создает неглубокую копию текущей Object.

(Унаследовано от Object)
OnComputePageCountCompleted(AsyncCompletedEventArgs)

Вызывает событие ComputePageCountCompleted.

(Унаследовано от DocumentPaginator)
OnGetPageCompleted(GetPageCompletedEventArgs)

Вызывает событие GetPageCompleted.

(Унаследовано от DocumentPaginator)
OnPagesChanged(PagesChangedEventArgs)

Вызывает событие PagesChanged.

(Унаследовано от DocumentPaginator)
ToString()

Возвращает строку, представляющую текущий объект.

(Унаследовано от Object)

События

Имя Описание
ComputePageCountCompleted

Происходит после ComputePageCountAsync завершения операции.

(Унаследовано от DocumentPaginator)
GetPageCompleted

Происходит при GetPageAsync завершении.

(Унаследовано от DocumentPaginator)
PagesChanged

Происходит при изменении содержимого документа.

(Унаследовано от DocumentPaginator)

Применяется к