This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/save-a-file/annotation-to-xmp.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Save a file from the annotation manager in C# .NET | Nutrient .NET SDK
To XMP

Nutrient .NET SDK (formerly GdPicture.NET) lets you export GdPicture/XMP annotations with the SaveAnnotationsToXMP method and the SaveAnnotationsToXMPEx method.

You can use these methods to:

Saving annotations from an image

To save annotations from an image to XML (file or stream), use SaveAnnotationsToXMP.

using GdPicture14;
using GdPicture14.Annotations;
using System;
using System.Drawing;
using AnnotationManager annotationManager = new AnnotationManager();
GdPictureStatus status = annotationManager.InitFromFile(@"C:\temp\source.jpg");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"InitFromFile failed: {status}");
return;
}
AnnotationRubberStamp stamp = annotationManager.AddRubberStampAnnot(
Color.Red,
0.5f,
0.5f,
2,
1,
"APPROVED");
if (stamp == null)
{
Console.WriteLine("AddRubberStampAnnot failed.");
return;
}
stamp.Rotation = 20;
status = annotationManager.SaveAnnotationsToPage();
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToPage failed: {status}");
return;
}
status = annotationManager.SaveAnnotationsToXMP(@"C:\temp\output.xml");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToXMP failed: {status}");
}

Saving annotations from a specific page

To save annotations from one page of a multipage document, select the page first, and then call SaveAnnotationsToXMP.

Use the SelectPage method to choose the page in multipage formats like PDF or TIFF.

using GdPicture14;
using GdPicture14.Annotations;
using System;
using System.Drawing;
using AnnotationManager annotationManager = new AnnotationManager();
GdPictureStatus status = annotationManager.InitFromFile(@"C:\temp\source.pdf");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"InitFromFile failed: {status}");
return;
}
status = annotationManager.SelectPage(1);
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SelectPage failed: {status}");
return;
}
AnnotationRubberStamp stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5f, 0.5f, 2, 1, "APPROVED");
if (stamp == null)
{
Console.WriteLine("AddRubberStampAnnot failed.");
return;
}
stamp.Rotation = 20;
status = annotationManager.SaveAnnotationsToPage();
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToPage failed: {status}");
return;
}
status = annotationManager.SaveAnnotationsToXMP(@"C:\temp\output.xml");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToXMP failed: {status}");
}

Saving annotations from all pages

To save annotations from all pages of a multipage document, use SaveAnnotationsToXMPEx.

using GdPicture14;
using GdPicture14.Annotations;
using System;
using System.Drawing;
using AnnotationManager annotationManager = new AnnotationManager();
GdPictureStatus status = annotationManager.InitFromFile(@"C:\temp\source.pdf");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"InitFromFile failed: {status}");
return;
}
status = annotationManager.SelectPage(1);
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SelectPage failed: {status}");
return;
}
AnnotationRubberStamp stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5f, 0.5f, 2, 1, "APPROVED");
if (stamp == null)
{
Console.WriteLine("AddRubberStampAnnot failed.");
return;
}
stamp.Rotation = 20;
status = annotationManager.SaveAnnotationsToPage();
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToPage failed: {status}");
return;
}
status = annotationManager.SaveAnnotationsToXMPEx(@"C:\temp\output.xml");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToXMPEx failed: {status}");
}