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

To load a supported file into the AnnotationManager class, use the InitFromFile method.

InitFromFile takes a full file path and returns a GdPictureStatus, which should be checked before working with annotations.

The list of supported formats is available on the supported file types page.

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

To load a file into AnnotationManager, add an annotation, and save the result, use the following code:

In some cross-platform GdPicture.API (net8.0) setups, AnnotationManager.AddRubberStampAnnot(...) expects GdPicture14.Imaging.GdPictureColor rather than System.Drawing.Color. If Color.Red from System.Drawing causes a type mismatch, use a GdPictureColor value instead (for example, GdPictureColor.Red or GdPicture14.Imaging.GdPictureColor.Red) or explicitly construct a GdPictureColor.

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.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}");
}