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 require a license to the DevExpress Office File API or DevExpress Universal Subscription to use these examples in production code. Refer to the DevExpress Subscription page for pricing information.

This example shows how to change an existing markup annotation’s settings in a PDF document.

image

using DevExpress.Pdf;
using System;
using System.Collections.Generic;

namespace ModifyExistingMarkupAnnotation
{

    class Program {
        static void Main(string[] args)
        {

            // Create a PDF Document Processor.
            using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
            {

                // Load a document.
                processor.LoadDocument("..\\..\\Document.pdf");

                // Get a list of annotations in the first document page.
                IList<PdfMarkupAnnotationData> annotations = processor.GetMarkupAnnotationData(1);

                if (annotations.Count > 0) {

                    // Change the properties of the first annotation.
                    annotations[0].Author = "Bill Smith";
                    annotations[0].Contents = "Important!";
                    annotations[0].Color = new PdfRGBColor(0.6, 0.7, 0.3);
                    annotations[0].Opacity = 0.2;

                    // Save the result document.
                    processor.SaveDocument("..\\..\\Result.pdf");
                }
                else
                    Console.WriteLine("The specified document page does not contain markup annotations!");
            }
        }
    }
}
See Also