Skip to main content
A newer version of this page is available. .

How to: Modify an Existing Text Markup Annotation

  • 2 minutes to read

Important

You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use these examples in production code.

The code sample below changes the markup style for annotations made by a specific author and changes the icon for all text annotations:

image

using DevExpress.Pdf;
using System;
using System.Collections.Generic;
//...
private static void EditAnnotations(PdfDocumentProcessor processor)
{
    //Retrieve annotations made by the specified author:
    var textMarkups =
        processor.GetMarkupAnnotationData(1).
        Where(annotation => annotation.Author.Contains("Cardle Anita L"));
    foreach (PdfMarkupAnnotationData markup in textMarkups)
    {
        //Get all text markup annotations from the retrieved list:
        PdfTextMarkupAnnotationData pdfTextMarkup =
         markup.AsTextMarkupAnnotation();
        if (pdfTextMarkup != null)
            //Change the annotation's markup type:
            pdfTextMarkup.MarkupType = PdfTextMarkupAnnotationType.Squiggly;
    }

    var annotations = processor.GetMarkupAnnotationData(1);
    foreach (PdfMarkupAnnotationData annotation in annotations)
    {
        //Get all text annotations:
        PdfTextAnnotationData textAnnotation = annotation.AsTextAnnotation();
        if (textAnnotation != null)

            //Change the annotation icon:
            textAnnotation.IconName = PdfTextAnnotationIconName.Note;
    }
}
See Also