Skip to main content
.NET Framework 4.5.2+

PdfDocumentProcessor.AddTextMarkupAnnotation(Int32, PdfRectangle, PdfTextMarkupAnnotationType) Method

Creates a text markup annotation for the text located in the specified page rectangle.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v22.2.dll


public PdfTextMarkupAnnotationData AddTextMarkupAnnotation(
    int pageNumber,
    PdfRectangle rectangle,
    PdfTextMarkupAnnotationType style


Name Type Description
pageNumber Int32

The number of a page where the annotation should be added.

rectangle PdfRectangle

The rectangle with the text that should be annotated.

style PdfTextMarkupAnnotationType

The text markup annotation type.


Type Description

The text markup annotation.


If a specified rectangle does not contain text, the annotation is not created and the method returns null.

The code sample below highlights text with blue and adds a sticky note at the page corner.


using DevExpress.Pdf;
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    //Load a document:

    //Add a text markup annotation at the first page:
    PdfTextMarkupAnnotationData textMarkup =
    processor.AddTextMarkupAnnotation(1, new PdfRectangle(90, 100, 240, 230),

    if (textMarkup != null)
        //Specify the annotation properties:
        textMarkup.Author = "Bill Smith";
        textMarkup.Contents = "Important!";
        textMarkup.Color = new PdfRGBColor(0.8, 0.2, 0.1);

    //Add a sticky note at the first page:
    PdfTextAnnotationData textAnnotation =
    processor.AddTextAnnotation(1, new PdfPoint(100, 300));

    //Specify the annotation parameters:
    textAnnotation.Author = "Nancy Davolio";
    textAnnotation.Checked = true;
    textAnnotation.Color = new PdfRGBColor(0.8, 0.2, 0.1);
    textAnnotation.Contents = "Please proofread this document";
    textAnnotation.IconName = PdfTextAnnotationIconName.Check;

    //Save the result:

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddTextMarkupAnnotation(Int32, PdfRectangle, PdfTextMarkupAnnotationType) method.


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