---
title: "Load a stream for annotation manager in C# .NET | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/load-a-file/annotation-stream/"
md_url: "https://www.nutrient.io/guides/dotnet/load-a-file/annotation-stream.md"
last_updated: "2026-05-25T14:09:00.286Z"
description: "Learn how to load annotations in .NET for various file types including any file, stream, and XML. Step-by-step guidance for developers."
---

# Load a stream for the annotation manager in C#

### Any File

[Any File](https://www.nutrient.io/guides/dotnet/load-a-file/annotation-any-file.md)

### Stream

[Stream](https://www.nutrient.io/guides/dotnet/load-a-file/annotation-stream.md)

### XML

[XML](https://www.nutrient.io/guides/dotnet/load-a-file/annotation-xml.md)

To load a `Stream` into the [`AnnotationManager` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.AnnotationManager.html), use the [`InitFromStream` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.AnnotationManager~InitFromStream.html).

`InitFromStream` overloads:

- `InitFromStream(Stream)`

- `InitFromStream(Stream, string FileName)`

Parameters:

- `Stream` — The input stream containing document data.

- `FileName` (optional) — A file name/path hint used for format detection when needed (for example, for formats that may require extension-based identification).

`InitFromStream` returns a `GdPictureStatus`, which should be checked before applying annotations.

The list of supported file formats is available on the [supported file types](https://www.nutrient.io/guides/dotnet/about/file-type-support.md) page.

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

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

### C#

```csharp

using GdPicture14;
using GdPicture14.Annotations;
using System;
using System.Drawing;
using System.IO;

using AnnotationManager annotationManager = new AnnotationManager();
using Stream file = new FileStream(@"C:\temp\source.txt", FileMode.Open, FileAccess.Read);

GdPictureStatus status = annotationManager.InitFromStream(file, @"C:\temp\source.txt");
if (status!= GdPictureStatus.OK)
{
    Console.WriteLine($"InitFromStream 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}");
}

```

### VB.NET

```vb

Imports GdPicture14
Imports GdPicture14.Annotations
Imports System.Drawing
Imports System.IO

Using annotationManager As New AnnotationManager(),
      file As Stream = New FileStream("C:\temp\source.txt", FileMode.Open, FileAccess.Read)

    Dim status As GdPictureStatus = annotationManager.InitFromStream(file, "C:\temp\source.txt")
    If status <> GdPictureStatus.OK Then
        Console.WriteLine($"InitFromStream failed: {status}")
        Return
    End If

    Dim stamp As AnnotationRubberStamp = annotationManager.AddRubberStampAnnot(
        Color.Red,
        0.5F,
        0.5F,
        2,
        1,
        "APPROVED")

    If stamp Is Nothing Then
        Console.WriteLine("AddRubberStampAnnot failed.")
        Return
    End If

    stamp.Rotation = 20

    status = annotationManager.SaveAnnotationsToPage()
    If status <> GdPictureStatus.OK Then
        Console.WriteLine($"SaveAnnotationsToPage failed: {status}")
        Return
    End If

    status = annotationManager.BurnAnnotationsToPage(False)
    If status <> GdPictureStatus.OK Then
        Console.WriteLine($"BurnAnnotationsToPage failed: {status}")
        Return
    End If

    status = annotationManager.SaveDocumentToJPEG("C:\temp\output.jpg", 100)
    If status <> GdPictureStatus.OK Then
        Console.WriteLine($"SaveDocumentToJPEG failed: {status}")
    End If
End Using

```
---

## Related pages

- [Load any file for the annotation manager in C#](/guides/dotnet/load-a-file/annotation-any-file.md)
- [Load files in C#](/guides/dotnet/load-a-file.md)
- [Load an XML file for the annotation manager in C#](/guides/dotnet/load-a-file/annotation-xml.md)

