---
title: "Add text markup annotations in C# | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/editor/add-text-markup-annotations-to-pdf/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/editor/add-text-markup-annotations-to-pdf.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "How to add text markup annotations to a PDF using Nutrient .NET SDK."
---

# Adding text markup annotations to a PDF document

Use text markup annotations to add review feedback directly on text in PDF files.

Common use cases include:

- Proofreading workflows

- Collaborative document review

- Content highlighting and emphasis

- Revision and deletion tracking

In this guide, you’ll add:

- Highlight annotations

- Underline annotations

- Strikeout annotations

- Squiggly annotations

- Custom colors for each markup type

[Download sample](https://www.nutrient.io/downloads/samples/csharp/add-text-markup-annotations-to-pdf.zip)

## How Nutrient helps

Nutrient.NET SDK handles text markup annotation structures and appearance generation.

The SDK handles:

- Text markup dictionaries and quadrilateral arrays

- Translucent overlays and blend modes

- Coordinate calculations and bounding box intersections

- Appearance streams and color transformations

## Complete implementation

This example adds several text markup annotations to a PDF file:

```csharp

using Nutrient;

```

## Working with text markup annotations

Open the document with [using statements](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using) so resources are cleaned up after processing.

Then:

- Create a PDF editor.

- Get the page collection.

- Add a letter-size page (`612 × 792`) if the document is empty.

- Get the annotation collection from the first page.

```csharp

try
{
    using Document document = Document.Open("input.pdf");
    using PdfEditor editor = PdfEditor.Edit(document);
    PdfPageCollection pages = editor.PageCollection;

    if (pages.Count == 0)
    {
        pages.Add(612.0f, 792.0f);
    }

    PdfPage page = pages.First?? throw new InvalidOperationException("The document has no pages.");
    PdfAnnotationCollection annotations = page.AnnotationCollection;

```

## Adding a highlight annotation

Add a highlight with `AddHighlight(x, y, width, height, author, contents)`.

In this sample:

- The position is `(50, 700)`.

- The size is `150 × 20`.

- The color is set to translucent yellow with `Color.FromArgb(128, 255, 255, 0)`.

- The alpha value `128` gives 50 percent opacity.

```csharp

    PdfHighlightAnnotation highlight = annotations.AddHighlight(
        50.0f, 700.0f, 150.0f, 20.0f, // x, y, width, height
        "Highlighter",
        "Important information"
    );
    // Optionally customize the color
    highlight.Color = Color.FromArgb(128, 255, 255, 0);

```

## Adding an underline annotation

Add an underline with `AddUnderline(x, y, width, height, author, contents)`.

In this sample:

- The position is `(50, 650)`.

- The size is `150 × 20`.

- The color is set to blue with `Color.FromArgb(255, 0, 0, 255)`.

```csharp

    PdfUnderlineAnnotation underline = annotations.AddUnderline(
        50.0f, 650.0f, 150.0f, 20.0f, // x, y, width, height
        "Underliner",
        "Emphasized text"
    );
    // Optionally customize the color.
    underline.Color = Color.FromArgb(255, 0, 0, 255);

```

## Adding a strikeout annotation

Add a strikeout with `AddStrikeOut(x, y, width, height, author, contents)`.

In this sample:

- The position is `(50, 600)`.

- The size is `150 × 20`.

- The default color is red (`ARGB 255, 255, 0, 0`).

- Use this style to mark text for removal.

```csharp

    PdfStrikeOutAnnotation strikeOut = annotations.AddStrikeOut(
        50.0f, 600.0f, 150.0f, 20.0f, // x, y, width, height
        "Reviewer",
        "This content should be removed"
    );

```

## Adding a squiggly annotation

Add a squiggly underline with `AddSquiggly(x, y, width, height, author, contents)`.

In this sample:

- The position is `(50, 550)`.

- The size is `150 × 20`.

- The color is changed to green with `Color.FromArgb(255, 0, 128, 0)`.

- Use this style to flag spelling or grammar issues.

```csharp

    PdfSquigglyAnnotation squiggly = annotations.AddSquiggly(
        50.0f, 550.0f, 150.0f, 20.0f, // x, y, width, height
        "Proofreader",
        "Check spelling here"
    );
    // Optionally customize the color
    squiggly.Color = Color.FromArgb(255, 0, 128, 0);

```

## Saving the document

Save the output PDF.

The `catch` block catches `NutrientException` if processing fails:

```csharp

    editor.SaveAs("output.pdf");
    Console.WriteLine("Successfully saved output.pdf");
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

## Conclusion

Use this workflow to add text markup annotations:

1. Open the document with `using` statements for automatic resource cleanup.

2. Create an editor and access the page collection.

3. Ensure at least one page exists by adding a letter-size page if needed.

4. Retrieve the annotation collection from the target page.

5. Add highlight annotations with translucent overlays using `AddHighlight()` for emphasizing content.

6. Customize highlight transparency using ARGB alpha values (128 = 50 percent transparency).

7. Add underline annotations with `AddUnderline()` for drawing attention beneath text.

8. Add strikeout annotations with `AddStrikeOut()` for marking deleted or outdated content.

9. Add squiggly annotations with `AddSquiggly()` for indicating spelling or grammar issues.

10. Customize text markup colors using the `Color` property with ARGB color values.

11. Position annotations with consistent vertical spacing to create organized markup sequences.

12. Save the document — the `using` statements release the native handles.

For related annotation workflows, refer to the [.NET SDK annotation guides](https://www.nutrient.io/guides/dotnet/csharp/editor.md).
---

## Related pages

- [Nutrient .NET SDK editor guides](/guides/dotnet/csharp/editor.md)
- [Adding annotations to a PDF document](/guides/dotnet/csharp/editor/add-annotations-to-pdf.md)
- [Adding a custom page to a PDF document](/guides/dotnet/csharp/editor/add-custom-page-to-pdf.md)
- [Adding interactive form fields to a PDF document](/guides/dotnet/csharp/editor/add-form-fields-to-pdf.md)
- [Adding free text annotations to a PDF document](/guides/dotnet/csharp/editor/add-freetext-annotations-to-pdf.md)
- [Adding invisible digital signatures to a PDF document](/guides/dotnet/csharp/editor/add-invisible-signature-to-pdf.md)
- [Adding link annotations to a PDF document](/guides/dotnet/csharp/editor/add-link-annotations-to-pdf.md)
- [Adding redaction annotations to a PDF document](/guides/dotnet/csharp/editor/add-redaction-annotations-to-pdf.md)
- [Adding shape annotations to a PDF document](/guides/dotnet/csharp/editor/add-shape-annotations-to-pdf.md)
- [Adding stamp annotations to a PDF document](/guides/dotnet/csharp/editor/add-stamp-annotations-to-pdf.md)
- [Adding sticky note annotations to a PDF document](/guides/dotnet/csharp/editor/add-sticky-note-annotations-to-pdf.md)
- [Adding visible digital signatures to a PDF document](/guides/dotnet/csharp/editor/add-visible-signature-to-pdf.md)
- [Advanced digital signature workflows](/guides/dotnet/csharp/editor/advanced-digital-signatures.md)
- [Detecting and adding form fields to a PDF document](/guides/dotnet/csharp/editor/detect-and-add-form-fields.md)
- [Editing PDF form fields](/guides/dotnet/csharp/editor/editing-pdf-form-fields.md)
- [Editing PDF metadata with Nutrient .NET SDK](/guides/dotnet/csharp/editor/editing-pdf-metadata.md)
- [Filling PDF form fields](/guides/dotnet/csharp/editor/fill-pdf-form.md)
- [Managing PDF page order](/guides/dotnet/csharp/editor/manage-pdf-page-order.md)
- [Merging PDFs](/guides/dotnet/csharp/editor/merge-pdf-into-other-pdf.md)

