Skip to main content
A newer version of this page is available. .
All docs
V20.2

PdfViewer.AnnotationCreating Event

Fires before the annotation is created.

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v20.2.dll

NuGet Package: DevExpress.Win.PdfViewer

Declaration

public event PdfAnnotationCreatingEventHandler AnnotationCreating

Event Data

The AnnotationCreating event's data class is PdfAnnotationCreatingEventArgs. The following properties provide information specific to this event:

Property Description
Builder Gets the object used to build an annotation.
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.

Remarks

The AnnotationCreating event fires when the user creates an annotation from the User Interface or after one of the following methods are called:

Method Description
PdfViewer.HighlightSelectedText Highlights selected text.
PdfViewer.StrikethroughSelectedText Marks the selected text with a strikeout line.
PdfViewer.UnderlineSelectedText Underlines the selected text.
PdfViewer.AddStickyNote Adds a sticky note at the specified position.

The PdfAnnotationCreatingEventArgs.Builder property retrieves the annotation parameters. Use the PdfViewerAnnotationBuilderExtensions class methods to obtain a specific type of annotation..

The following code shows how to handle the PdfViewer.AnnotationCreating event.

View Example: How to Specify Markup Annotations

using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraPdfViewer;

private void pdfViewer1_TextMarkupAnnotationCreating(object sender,
PdfAnnotationCreatingEventArgs e)
{
    //Specify options for text markup and text annotations:
    if (e.Builder.AnnotationType == PdfAnnotationType.TextMarkup
     || e.Builder.AnnotationType == PdfAnnotationType.Text)
    {
        //Retrieve common options for text and text markup annotations:
        var annotationBuilder = e.Builder.AsMarkupAnnotationBuilder();
        annotationBuilder.Author = "John Smith";
        annotationBuilder.Color = new PdfRGBColor(0.20, 0.60, 1.00);
        annotationBuilder.Contents = "Note";
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AnnotationCreating event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also