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

To load GdPicture/XMP annotations from XML into the AnnotationManager class, use the LoadAnnotationsFromXMP method.

Supported overloads:

  • LoadAnnotationsFromXMP(string FilePath)
  • LoadAnnotationsFromXMP(Stream Stream)

This method replaces annotations currently managed by the AnnotationManager instance.

AnnotationManager handles GdPicture annotations and XMP annotations contained in the source document.

To apply annotations from a template image to another image, use the following code:

using GdPicture14;
using System;
using AnnotationManager annotationManager = new AnnotationManager();
GdPictureStatus status = annotationManager.InitFromFile(@"C:\temp\template.jpg");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"InitFromFile(template) failed: {status}");
return;
}
status = annotationManager.SaveAnnotationsToXMP(@"C:\temp\annotTemplate.xml");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAnnotationsToXMP failed: {status}");
return;
}
status = annotationManager.InitFromFile(@"C:\temp\source.jpg");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"InitFromFile(source) failed: {status}");
return;
}
status = annotationManager.LoadAnnotationsFromXMP(@"C:\temp\annotTemplate.xml");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"LoadAnnotationsFromXMP failed: {status}");
return;
}
status = annotationManager.BurnAnnotationsToPage(false);
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"BurnAnnotationsToPage failed: {status}");
return;
}
status = annotationManager.SaveDocumentToJPEG(@"C:\temp\output.jpg", 100);
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveDocumentToJPEG failed: {status}");
}