---
title: "PdfAnnotationCollection"
canonical_url: "https://www.nutrient.io/api/csharp/editors/pdf/annotations/pdf-annotation-collection/"
md_url: "https://www.nutrient.io/api/csharp/editors/pdf/annotations/pdf-annotation-collection.md"
last_updated: "2026-10-08T08:55:57.709Z"
description: "Represents a collection of annotations on a PDF page. Provides methods to access, add, and remove annotations."
---

Represents a collection of annotations on a PDF page. Provides methods to access, add, and remove annotations.

```csharp

using Nutrient;

```

The SDK creates this class through factory methods or other SDK objects.

## Collection access

`PdfAnnotationCollection` implements `IReadOnlyList<PdfAnnotation>`, so you can index it, read its `Count`, and iterate it with `foreach`.

```csharp

public PdfAnnotation this[int index] { get; }

```

Gets the element at the specified 0-based index. **Type:** [`PdfAnnotation`](/api/csharp/editors/pdf/annotations/pdf-annotation/)

## Properties

### Count

```csharp

public int Count { get; }

```

The number of annotations in the collection.

**Type:** `int`

## Methods

### AddCircle

```csharp

public PdfCircleAnnotation AddCircle(float x, float y, float width, float height, string author, string contents)

```

Adds a circle (ellipse) annotation to this page.

**Parameters**

| Name       | Type     | Description                                           |
| ---------- | -------- | ----------------------------------------------------- |
| `x`        | `float`  | The x coordinate of the bounding rectangle in points. |
| `y`        | `float`  | The y coordinate of the bounding rectangle in points. |
| `width`    | `float`  | The width of the bounding rectangle in points.        |
| `height`   | `float`  | The height of the bounding rectangle in points.       |
| `author`   | `string` | The author of the annotation.                         |
| `contents` | `string` | The text contents/comment for the annotation.         |

**Returns:** [`PdfCircleAnnotation`](/api/csharp/editors/pdf/annotations/pdf-circle-annotation/) - The newly created `PdfCircleAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddFreeText

```csharp

public PdfFreeTextAnnotation AddFreeText(float x, float y, float width, float height, string author, string contents, string fontName, float fontSize, Color fontColor)

```

Adds a free text annotation (text box) to this page.

**Parameters**

| Name        | Type                                | Description                                 |
| ----------- | ----------------------------------- | ------------------------------------------- |
| `x`         | `float`                             | The x coordinate of the text box in points. |
| `y`         | `float`                             | The y coordinate of the text box in points. |
| `width`     | `float`                             | The width of the text box in points.        |
| `height`    | `float`                             | The height of the text box in points.       |
| `author`    | `string`                            | The author of the annotation.               |
| `contents`  | `string`                            | The text contents to display.               |
| `fontName`  | `string`                            | The name of the font to use.                |
| `fontSize`  | `float`                             | The size of the font in points.             |
| `fontColor` | [`Color`](/api/csharp/types/color/) | The color of the text.                      |

**Returns:** [`PdfFreeTextAnnotation`](/api/csharp/editors/pdf/annotations/pdf-free-text-annotation/) - The newly created `PdfFreeTextAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddHighlight

```csharp

public PdfHighlightAnnotation AddHighlight(float x, float y, float width, float height, string author, string contents)

```

Adds a highlight annotation to this page.

**Parameters**

| Name       | Type     | Description                                       |
| ---------- | -------- | ------------------------------------------------- |
| `x`        | `float`  | The x coordinate of the highlight area in points. |
| `y`        | `float`  | The y coordinate of the highlight area in points. |
| `width`    | `float`  | The width of the highlight area in points.        |
| `height`   | `float`  | The height of the highlight area in points.       |
| `author`   | `string` | The author of the annotation.                     |
| `contents` | `string` | The text contents/comment for the annotation.     |

**Returns:** [`PdfHighlightAnnotation`](/api/csharp/editors/pdf/annotations/pdf-highlight-annotation/) - The newly created `PdfHighlightAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddLine

```csharp

public PdfLineAnnotation AddLine(float startX, float startY, float endX, float endY, string author, string contents)

```

Adds a line annotation to this page.

**Parameters**

| Name       | Type     | Description                                     |
| ---------- | -------- | ----------------------------------------------- |
| `startX`   | `float`  | X coordinate of the line start point in points. |
| `startY`   | `float`  | Y coordinate of the line start point in points. |
| `endX`     | `float`  | X coordinate of the line end point in points.   |
| `endY`     | `float`  | Y coordinate of the line end point in points.   |
| `author`   | `string` | The author of the annotation.                   |
| `contents` | `string` | The text contents/comment for the annotation.   |

**Returns:** [`PdfLineAnnotation`](/api/csharp/editors/pdf/annotations/pdf-line-annotation/) - The newly created `PdfLineAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddLink

```csharp

public PdfLinkAnnotation AddLink(float x, float y, float width, float height)

```

Adds an empty link annotation to this page. Use the returned annotation's `URI` property or `SetDestination` method to configure the link target.

**Parameters**

| Name     | Type    | Description                                  |
| -------- | ------- | -------------------------------------------- |
| `x`      | `float` | The x coordinate of the link area in points. |
| `y`      | `float` | The y coordinate of the link area in points. |
| `width`  | `float` | The width of the link area in points.        |
| `height` | `float` | The height of the link area in points.       |

**Returns:** [`PdfLinkAnnotation`](/api/csharp/editors/pdf/annotations/pdf-link-annotation/) - The newly created `PdfLinkAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddRedact

```csharp

public PdfRedactAnnotation AddRedact(float x, float y, float width, float height)

```

Adds a redaction annotation to this page. The annotation marks content for redaction but does not apply the redaction until `ApplyRedactions` is called.

**Parameters**

| Name     | Type    | Description                                       |
| -------- | ------- | ------------------------------------------------- |
| `x`      | `float` | The x coordinate of the redaction area in points. |
| `y`      | `float` | The y coordinate of the redaction area in points. |
| `width`  | `float` | The width of the redaction area in points.        |
| `height` | `float` | The height of the redaction area in points.       |

**Returns:** [`PdfRedactAnnotation`](/api/csharp/editors/pdf/annotations/pdf-redact-annotation/) - The newly created `PdfRedactAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddSquare

```csharp

public PdfSquareAnnotation AddSquare(float x, float y, float width, float height, string author, string contents)

```

Adds a square (rectangle) annotation to this page.

**Parameters**

| Name       | Type     | Description                                   |
| ---------- | -------- | --------------------------------------------- |
| `x`        | `float`  | The x coordinate of the rectangle in points.  |
| `y`        | `float`  | The y coordinate of the rectangle in points.  |
| `width`    | `float`  | The width of the rectangle in points.         |
| `height`   | `float`  | The height of the rectangle in points.        |
| `author`   | `string` | The author of the annotation.                 |
| `contents` | `string` | The text contents/comment for the annotation. |

**Returns:** [`PdfSquareAnnotation`](/api/csharp/editors/pdf/annotations/pdf-square-annotation/) - The newly created `PdfSquareAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddSquiggly

```csharp

public PdfSquigglyAnnotation AddSquiggly(float x, float y, float width, float height, string author, string contents)

```

Adds a squiggly underline annotation to this page.

**Parameters**

| Name       | Type     | Description                                      |
| ---------- | -------- | ------------------------------------------------ |
| `x`        | `float`  | The x coordinate of the squiggly area in points. |
| `y`        | `float`  | The y coordinate of the squiggly area in points. |
| `width`    | `float`  | The width of the squiggly area in points.        |
| `height`   | `float`  | The height of the squiggly area in points.       |
| `author`   | `string` | The author of the annotation.                    |
| `contents` | `string` | The text contents/comment for the annotation.    |

**Returns:** [`PdfSquigglyAnnotation`](/api/csharp/editors/pdf/annotations/pdf-squiggly-annotation/) - The newly created `PdfSquigglyAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddStamp

```csharp

public PdfStampAnnotation AddStamp(float x, float y, float width, float height, string title, string contents)

```

Adds a rubber stamp annotation to this page.

**Parameters**

| Name       | Type     | Description                              |
| ---------- | -------- | ---------------------------------------- |
| `x`        | `float`  | The x coordinate of the stamp in points. |
| `y`        | `float`  | The y coordinate of the stamp in points. |
| `width`    | `float`  | The width of the stamp in points.        |
| `height`   | `float`  | The height of the stamp in points.       |
| `title`    | `string` | The title of the annotation.             |
| `contents` | `string` | The text contents of the annotation.     |

**Returns:** [`PdfStampAnnotation`](/api/csharp/editors/pdf/annotations/pdf-stamp-annotation/) - The newly created `PdfStampAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddStickyNote

```csharp

public PdfTextAnnotation AddStickyNote(float x, float y, string author, string subject, string contents)

```

Adds a sticky note (text) annotation to this page.

**Parameters**

| Name       | Type     | Description                                   |
| ---------- | -------- | --------------------------------------------- |
| `x`        | `float`  | The x coordinate of the annotation in points. |
| `y`        | `float`  | The y coordinate of the annotation in points. |
| `author`   | `string` | The author of the annotation.                 |
| `subject`  | `string` | The subject of the annotation.                |
| `contents` | `string` | The text contents of the annotation.          |

**Returns:** [`PdfTextAnnotation`](/api/csharp/editors/pdf/annotations/pdf-text-annotation/) - The newly created `PdfTextAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddStrikeOut

```csharp

public PdfStrikeOutAnnotation AddStrikeOut(float x, float y, float width, float height, string author, string contents)

```

Adds a strikeout annotation to this page.

**Parameters**

| Name       | Type     | Description                                       |
| ---------- | -------- | ------------------------------------------------- |
| `x`        | `float`  | The x coordinate of the strikeout area in points. |
| `y`        | `float`  | The y coordinate of the strikeout area in points. |
| `width`    | `float`  | The width of the strikeout area in points.        |
| `height`   | `float`  | The height of the strikeout area in points.       |
| `author`   | `string` | The author of the annotation.                     |
| `contents` | `string` | The text contents/comment for the annotation.     |

**Returns:** [`PdfStrikeOutAnnotation`](/api/csharp/editors/pdf/annotations/pdf-strike-out-annotation/) - The newly created `PdfStrikeOutAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### AddUnderline

```csharp

public PdfUnderlineAnnotation AddUnderline(float x, float y, float width, float height, string author, string contents)

```

Adds an underline annotation to this page.

**Parameters**

| Name       | Type     | Description                                       |
| ---------- | -------- | ------------------------------------------------- |
| `x`        | `float`  | The x coordinate of the underline area in points. |
| `y`        | `float`  | The y coordinate of the underline area in points. |
| `width`    | `float`  | The width of the underline area in points.        |
| `height`   | `float`  | The height of the underline area in points.       |
| `author`   | `string` | The author of the annotation.                     |
| `contents` | `string` | The text contents/comment for the annotation.     |

**Returns:** [`PdfUnderlineAnnotation`](/api/csharp/editors/pdf/annotations/pdf-underline-annotation/) - The newly created `PdfUnderlineAnnotation`.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

### RemoveAt

```csharp

public void RemoveAt(int index)

```

Removes the annotation at the specified index.

**Parameters**

| Name    | Type  | Description                                    |
| ------- | ----- | ---------------------------------------------- |
| `index` | `int` | The 0-based index of the annotation to remove. |

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when no page is loaded.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the index is out of range.

**Throws:** [`NutrientException`](/api/csharp/exceptions/nutrient-exception/) - Thrown when the operation fails.

## Resource management

```csharp

public void Dispose()

```

`PdfAnnotationCollection` implements `IDisposable`. Call `Dispose()` or use a C# `using` declaration to release its native handle right away. If you don't, the handle is released when the object is garbage collected.

---

## Related pages

- [Annotations](/api/csharp/editors/pdf/annotations.md)
- [Pdf Annotation](/api/csharp/editors/pdf/annotations/pdf-annotation.md)
- [Pdf Circle Annotation](/api/csharp/editors/pdf/annotations/pdf-circle-annotation.md)
- [Pdf Free Text Annotation](/api/csharp/editors/pdf/annotations/pdf-free-text-annotation.md)
- [Pdf Highlight Annotation](/api/csharp/editors/pdf/annotations/pdf-highlight-annotation.md)
- [Pdf Line Annotation](/api/csharp/editors/pdf/annotations/pdf-line-annotation.md)
- [Pdf Link Annotation](/api/csharp/editors/pdf/annotations/pdf-link-annotation.md)
- [Pdf Markup Annotation](/api/csharp/editors/pdf/annotations/pdf-markup-annotation.md)
- [Pdf Redact Annotation](/api/csharp/editors/pdf/annotations/pdf-redact-annotation.md)
- [Pdf Shape Annotation](/api/csharp/editors/pdf/annotations/pdf-shape-annotation.md)
- [Pdf Square Annotation](/api/csharp/editors/pdf/annotations/pdf-square-annotation.md)
- [Pdf Squiggly Annotation](/api/csharp/editors/pdf/annotations/pdf-squiggly-annotation.md)
- [Pdf Stamp Annotation](/api/csharp/editors/pdf/annotations/pdf-stamp-annotation.md)
- [Pdf Strike Out Annotation](/api/csharp/editors/pdf/annotations/pdf-strike-out-annotation.md)
- [Pdf Text Annotation](/api/csharp/editors/pdf/annotations/pdf-text-annotation.md)
- [Pdf Underline Annotation](/api/csharp/editors/pdf/annotations/pdf-underline-annotation.md)
- [Pdf Widget Annotation](/api/csharp/editors/pdf/annotations/pdf-widget-annotation.md)

