---
title: "XMP annotations in C# .NET | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/annotations/xmp-annotations/"
md_url: "https://www.nutrient.io/guides/dotnet/annotations/xmp-annotations.md"
last_updated: "2026-05-21T17:12:02.199Z"
description: "Learn to add XMP annotations using Nutrient .NET SDK (formerly GdPicture.NET). Explore types like text, rubber stamps, and geometric shapes for your PDF and image files."
---

# XMP annotations in C# .NET

Nutrient.NET SDK (formerly GdPicture.NET) enables you to create XMP annotations with the XML-based syntax. They can be added to PDF, JPG, and TIFF files. The XMP annotations are handled by the [`AnnotationManager` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html). The list below shows all possible XMP annotation types:

- Text annotation

- Rubber stamp

- Geometric — An annotation represented as a geometric figure (line, arrow, ellipse, polygon, and so on).

- Free hand — A freely drawn line.

- Comment annotation — An annotation linked to an already existing annotation.

- Sticky note — A text annotation confined in a colored rectangular area with borders.

## Adding an XMP annotation

To add an XMP annotation, follow the steps below:

1. Create an [`AnnotationManager` object](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html).

2. Load a file to the `AnnotationManager` object. For more information, refer to the guide on [loading a file to the `AnnotationManager` object](https://www.nutrient.io/guides/dotnet/load-a-file/annotation-any-file/).

3. Optional: Specify the page where to add the XMP annotation with the [`SelectPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SelectPage.html). This step is only required for PDF and TIFF files.

4. Use any method from the [`AnnotationManager` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html) that starts with `Add...` to add an XMP annotation. Alternatively, create a new annotation by using the specific annotation class — for example, the [`AnnotationEllipse` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.Annotations.AnnotationEllipse.html).

5. Optional: Set the [XMP annotation’s properties](#xmp-annotation-object-properties).

6. Save the newly created annotation to the page with the [`SaveAnnotationsToPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveAnnotationsToPage.html).

7. Optional: Flatten the XMP annotation into the file with the [`BurnAnnotationsToPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~BurnAnnotationsToPage.html). Flattened annotations are no longer editable.

8. Save the file. For more information, refer to the guide on [saving a file from the `AnnotationManager` object](https://www.nutrient.io/guides/dotnet/save-a-file/annotation-to-jpg/).

To add an ellipse XMP annotation and flatten it into to a JPG file, use the following code:

### C#

```csharp

using AnnotationManager annotationManager = new AnnotationManager();
// Load an image to the `AnnotationManager` object.
annotationManager.InitFromFile(@"C:\temp\source.jpg");
// Create a new `AnnotationEllipse` object.
AnnotationEllipse annotEllipse = annotationManager.AddEllipseAnnot(GdPictureColor.Aqua, 2, 1, 4, 2);
// Set the `Author` property of the annotation.
annotEllipse.Author = "Nutrient";
// Save the annotation to the image.
annotationManager.SaveAnnotationsToPage();
// Flatten the annotation.
annotationManager.BurnAnnotationsToPage(false);
// Save the image with the annotation to a file.
annotationManager.SaveDocumentToJPEG(@"C:\temp\output.jpg", 75);

```

### VB.NET

```vb

Using annotationManager As AnnotationManager = New AnnotationManager()
    ' Load an image to the `AnnotationManager` object.
    annotationManager.InitFromFile("C:\temp\source.jpg")
    ' Create a new `AnnotationEllipse` object.
    Dim annotEllipse As AnnotationEllipse = annotationManager.AddEllipseAnnot(GdPictureColor.Aqua, 2, 1, 4, 2)
    ' Set the `Author` property of the annotation.
    annotEllipse.Author = "Nutrient"
    ' Save the annotation to the image.
    annotationManager.SaveAnnotationsToPage()
    ' Flatten the annotation.
    annotationManager.BurnAnnotationsToPage(False)
    ' Save the image with the annotation to a file.
    annotationManager.SaveDocumentToJPEG("C:\temp\output.jpg", 75)
End Using

```

#### Used methods

- [`AddEllipseAnnot`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~AddEllipseAnnot.html)

- [`BurnAnnotationsToPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~BurnAnnotationsToPage.html)

- [`InitFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html)

- [`SaveAnnotationsToPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveAnnotationsToPage.html)

- [`SaveDocumentToJPEG`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveDocumentToJPEG.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)

## XMP annotation object properties

Each XMP annotation contains generic [annotation properties](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.Annotations.Annotation_properties.html#) and sometimes contains properties specific to the annotation type. To get or modify these properties, use the [`SetAnnotationPropertyValue` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SetAnnotationPropertyValue.html).

If you created an XMP annotation with the specific annotation class — for example, the [`AnnotationEllipse` class] — you can access its properties directly from the used annotation object.

To set the author of a newly created XMP annotation, use the following code:

### C#

```csharp

using AnnotationManager annotationManager = new AnnotationManager();
// Load an image to the `AnnotationManager` object.
annotationManager.InitFromFile(@"C:\temp\source.jpg");
// Add an ellipse annotation.
annotationManager.AddEllipseAnnot(GdPictureColor.Aqua, 2, 1, 4, 2);
// Set the `Author` property of the annotation.
annotationManager.SetAnnotationPropertyValue(0, "Author", "Nutrient");
// Save the annotation to the image.
annotationManager.SaveAnnotationsToPage();
// Save the image with the annotation to a file.
annotationManager.SaveDocumentToJPEG(@"C:\temp\output.jpg", 75);

```

### VB.NET

```vb

Using annotationManager As AnnotationManager = New AnnotationManager()
    ' Load an image to the `AnnotationManager` object.
    annotationManager.InitFromFile("C:\temp\source.jpg")
    ' Add an ellipse annotation.
    annotationManager.AddEllipseAnnot(GdPictureColor.Aqua, 2, 1, 4, 2)
    ' Set the `Author` property of the annotation.
    annotationManager.SetAnnotationPropertyValue(0, "Author", "Nutrient")
    ' Save the annotation to the image.
    annotationManager.SaveAnnotationsToPage()
    ' Save the image with the annotation to a file.
    annotationManager.SaveDocumentToJPEG("C:\temp\output.jpg", 75)
End Using

```

#### Used methods

- [`AddEllipseAnnot`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~AddEllipseAnnot.html)

- [`InitFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html)

- [`SetAnnotationPropertyValue`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SetAnnotationPropertyValue.html)

- [`SaveAnnotationsToPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveAnnotationsToPage.html)

- [`SaveDocumentToJPEG`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveDocumentToJPEG.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)

## Finding an existing XMP annotation

There are three different ways to find an existing XMP annotation:

- Get its index number.

- Get the whole XMP annotation object.

- Get the annotation’s XML content in a string form.

The method you use depends on which operations you perform on the annotation.

### Getting the index number

To get the XMP annotation’s index number, follow the steps below:

1. Create an [`AnnotationManager` object](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager.html).

2. Load a file to the `AnnotationManager` object. For more information, refer to the guide on [loading a file to the `AnnotationManager` object](https://www.nutrient.io/guides/dotnet/load-a-file/annotation-any-file/).

3. Optional: Specify the page where to add the XMP annotation with the [`SelectPage` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SelectPage.html). This step is only required for PDF and TIFF files.

4. Get the total amount of annotations with the [`GetAnnotationCount` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationCount.html).

5. Loop through all annotations.

6. Find the annotation that meets your search parameters. For example, use the [`GetAnnotationType`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationType.html) or the [`GetAnnotationPropertyValue`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationPropertyValue.html) methods.

### C#

```csharp

using AnnotationManager annotationManager = new AnnotationManager();
// Load an image to the `AnnotationManager` object.
annotationManager.InitFromFile(@"C:\temp\source.jpg");
// Get the total amount of XMP annotations.
int annotCount = annotationManager.GetAnnotationCount();
for(int i = 0; i < annotCount; i++)
{
    // Check if the current annotation is of the ellipse type.
    if(annotationManager.GetAnnotationType(i) == GdPictureAnnotationType.AnnotationTypeEllipse)
    {
        // Get the current annotation index number.
        Console.WriteLine("Index Number: {0}", i);
    }
}

```

### VB.NET

```vb

Using annotationManager As AnnotationManager = New AnnotationManager()
    ' Load an image to the `AnnotationManager` object.
    annotationManager.InitFromFile("C:\temp\source.jpg")
    ' Get the total amount of XMP annotations.
    Dim annotCount As Integer = annotationManager.GetAnnotationCount()
    For i = 0 To annotCount - 1
        ' Check if the current annotation is of the ellipse type.
        If annotationManager.GetAnnotationType(i) Is GdPictureAnnotationType.AnnotationTypeEllipse Then
            ' Get the current annotation index number.
            Console.WriteLine("Index Number: {0}", i)
        End If
    Next
End Using

```

#### Used methods

- [`GetAnnotationCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationCount.html)

- [`GetAnnotationType`]

- [`InitFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html)

### Getting the XMP annotation object

To get an existing XMP annotation object, use the [`GetAnnotationFromIdx` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationFromIdx.html). It requires the annotation’s [index number](#getting-the-index-number).

The following example changes the author property of all ellipse annotations:

### C#

```csharp

using AnnotationManager annotationManager = new AnnotationManager();
// Load an image to the `AnnotationManager` object.
annotationManager.InitFromFile(@"C:\temp\source.jpg");
// Get the total amount of XMP annotations.
int annotCount = annotationManager.GetAnnotationCount();
for(int i = 0; i < annotCount; i++)
{
    // Check if the current annotation is of the ellipse type.
    if(annotationManager.GetAnnotationType(i) == GdPictureAnnotationType.AnnotationTypeEllipse)
    {
        // Save the current annotation to an object.
        Annotation annot = annotationManager.GetAnnotationFromIdx(i);
        // Change the `Author` property.
        annot.Author = "Nutrient";
    }
}

```

### VB.NET

```vb

Using annotationManager As AnnotationManager = New AnnotationManager()
    ' Load an image to the `AnnotationManager` object.
    annotationManager.InitFromFile("C:\temp\source.jpg")
    ' Get the total amount of XMP annotations.
    Dim annotCount As Integer = annotationManager.GetAnnotationCount()
    For i = 0 To annotCount - 1
        ' Check if the current annotation is of the ellipse type.
        If annotationManager.GetAnnotationType(i) Is GdPictureAnnotationType.AnnotationTypeEllipse Then
            ' Save the current annotation to an object.
            Dim annot As Annotation = annotationManager.GetAnnotationFromIdx(i)
            ' Change the `Author` property.
            annot.Author = "Nutrient"
        End If
    Next
End Using

```

#### Used methods

- [`GetAnnotationCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationCount.html)

- [`GetAnnotationFromIdx`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationFromIdx.html)

- [`GetAnnotationType`]

- [`InitFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html)

### Getting the annotation XML content

To get the annotation’s XML content, use the [`GetAnnotationXML` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationXML.html). It requires the annotation’s [index number](#getting-the-index-number).

The following example gets the annotation’s XML content from the first page of a PDF document and creates new annotations on the rest of the pages based on the copied XML code:

### C#

```csharp

using AnnotationManager annotationManager = new AnnotationManager();
// Load an image to the `AnnotationManager` object.
annotationManager.InitFromFile(@"C:\temp\source.pdf");
// Select the first PDF page.
annotationManager.SelectPage(1);
// Get the total number of XMP annotations.
int annotCount = annotationManager.GetAnnotationCount();
string annotXML = "";
for (int i = 0; i < annotCount; i++)
{
    // Check if the current annotation is of the ellipse type.
    if (annotationManager.GetAnnotationType(i) == GdPictureAnnotationType.AnnotationTypeEllipse)
    {
        // Get the XML content of the current annotation.
        annotXML = annotationManager.GetAnnotationXML(i);
        break;
    }
}
// Get the PDF page count.
int pageCount = annotationManager.PageCount;
// Loop through all PDF pages.
for (int p= 2; p <= pageCount; p++)
{
    // Select the next page.
    annotationManager.SelectPage(p);
    // Add the annotation from XML.
    annotationManager.AddAnnotationFromXML(annotXML);
    // Save the annotation to the current page.
    annotationManager.SaveAnnotationsToPage();
}
annotationManager.SaveDocumentToPDF(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using annotationManager As AnnotationManager = New AnnotationManager()
    ' Load an image to the `AnnotationManager` object.
    annotationManager.InitFromFile("C:\temp\source.pdf")
    ' Select the first PDF page.
    annotationManager.SelectPage(1)
    ' Get the total amount of XMP annotations.
    Dim annotCount As Integer = annotationManager.GetAnnotationCount()
    Dim annotXML = ""
    For i = 0 To annotCount - 1
        ' Check if the current annotation is of the ellipse type.
        If annotationManager.GetAnnotationType(i) Is GdPictureAnnotationType.AnnotationTypeEllipse Then
            ' Get the XML content of the current annotation.
            annotXML = annotationManager.GetAnnotationXML(i)
            Exit For
        End If
    Next
    ' Get the PDF page count.
    Dim pageCount As Integer = annotationManager.PageCount
    ' Loop through all PDF pages.
    For p = 2 To pageCount
        ' Select the next page.
        annotationManager.SelectPage(p)
        ' Add the annotation from XML.
        annotationManager.AddAnnotationFromXML(annotXML)
        ' Save the annotation to the current page.
        annotationManager.SaveAnnotationsToPage()
    Next
    annotationManager.SaveDocumentToPDF("C:\temp\output.pdf")
End Using

```

#### Used methods

- [`AddAnnotationFromXML`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~AddAnnotationFromXML.html)

- [`GetAnnotationCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationCount.html)

- [`GetAnnotationType`]

- [`GetAnnotationXML`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~GetAnnotationXML.html)

- [`InitFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~InitFromFile.html)

- [`SaveAnnotationsToPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveAnnotationsToPage.html)

- [`SaveDocumentToPDF`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SaveDocumentToPDF.html)

- [`SelectPage`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.AnnotationManager~SelectPage.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)
---

## Related pages

- [Custom annotations](/guides/dotnet/annotations/custom-annotations.md)
- [Annotate on images in C# .NET](/guides/dotnet/annotations/annotate-on-images.md)
- [Attach an image to an annotation in C#](/guides/dotnet/annotations/attach-an-image.md)
- [Attach a file to an annotation in C#](/guides/dotnet/annotations/attach-a-file.md)
- [Create an annotation in a PDF using C#](/guides/dotnet/annotations/create.md)
- [Edit PDF annotations in C#](/guides/dotnet/annotations/edit.md)
- [Export XMP annotation data in C# .NET](/guides/dotnet/annotations/export-xmp.md)
- [Export annotation data from PDFs in C# .NET](/guides/dotnet/annotations/export-pdf.md)
- [Flatten PDF annotations in C# .NET](/guides/dotnet/annotations/flatten.md)
- [Get PDF annotation properties in C# .NET](/guides/dotnet/annotations/get-properties.md)
- [Import XFDF annotation data to PDFs in C# .NET](/guides/dotnet/annotations/import-xfdf.md)
- [Remove PDF annotations in C# .NET](/guides/dotnet/annotations/remove.md)
- [PDF annotations in C#.NET](/guides/dotnet/annotations.md)
- [Add PDF actions using C# in form fields](/guides/dotnet/annotations/pdf-actions-support.md)
- [Import XMP annotation data to PDF or image in C#](/guides/dotnet/annotations/import-xmp.md)
- [Stamp a PDF document in C# .NET](/guides/dotnet/annotations/stamp-a-document.md)

