This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/csharp/editors/pdf/annotations/pdf-annotation-collection.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. PdfAnnotationCollection

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

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.

public PdfAnnotation this[int index] { get; }

Gets the element at the specified 0-based index. Type: PdfAnnotation

Properties

Count

public int Count { get; }

The number of annotations in the collection.

Type: int

Methods

AddCircle

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

Adds a circle (ellipse) annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the bounding rectangle in points.
yfloatThe y coordinate of the bounding rectangle in points.
widthfloatThe width of the bounding rectangle in points.
heightfloatThe height of the bounding rectangle in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfCircleAnnotation - The newly created PdfCircleAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddFreeText

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

NameTypeDescription
xfloatThe x coordinate of the text box in points.
yfloatThe y coordinate of the text box in points.
widthfloatThe width of the text box in points.
heightfloatThe height of the text box in points.
authorstringThe author of the annotation.
contentsstringThe text contents to display.
fontNamestringThe name of the font to use.
fontSizefloatThe size of the font in points.
fontColorColorThe color of the text.

Returns: PdfFreeTextAnnotation - The newly created PdfFreeTextAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddHighlight

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

Adds a highlight annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the highlight area in points.
yfloatThe y coordinate of the highlight area in points.
widthfloatThe width of the highlight area in points.
heightfloatThe height of the highlight area in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfHighlightAnnotation - The newly created PdfHighlightAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddLine

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

Adds a line annotation to this page.

Parameters

NameTypeDescription
startXfloatX coordinate of the line start point in points.
startYfloatY coordinate of the line start point in points.
endXfloatX coordinate of the line end point in points.
endYfloatY coordinate of the line end point in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfLineAnnotation - The newly created PdfLineAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

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

NameTypeDescription
xfloatThe x coordinate of the link area in points.
yfloatThe y coordinate of the link area in points.
widthfloatThe width of the link area in points.
heightfloatThe height of the link area in points.

Returns: PdfLinkAnnotation - The newly created PdfLinkAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddRedact

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

NameTypeDescription
xfloatThe x coordinate of the redaction area in points.
yfloatThe y coordinate of the redaction area in points.
widthfloatThe width of the redaction area in points.
heightfloatThe height of the redaction area in points.

Returns: PdfRedactAnnotation - The newly created PdfRedactAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddSquare

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

Adds a square (rectangle) annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the rectangle in points.
yfloatThe y coordinate of the rectangle in points.
widthfloatThe width of the rectangle in points.
heightfloatThe height of the rectangle in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfSquareAnnotation - The newly created PdfSquareAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddSquiggly

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

Adds a squiggly underline annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the squiggly area in points.
yfloatThe y coordinate of the squiggly area in points.
widthfloatThe width of the squiggly area in points.
heightfloatThe height of the squiggly area in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfSquigglyAnnotation - The newly created PdfSquigglyAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddStamp

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

Adds a rubber stamp annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the stamp in points.
yfloatThe y coordinate of the stamp in points.
widthfloatThe width of the stamp in points.
heightfloatThe height of the stamp in points.
titlestringThe title of the annotation.
contentsstringThe text contents of the annotation.

Returns: PdfStampAnnotation - The newly created PdfStampAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddStickyNote

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

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

Parameters

NameTypeDescription
xfloatThe x coordinate of the annotation in points.
yfloatThe y coordinate of the annotation in points.
authorstringThe author of the annotation.
subjectstringThe subject of the annotation.
contentsstringThe text contents of the annotation.

Returns: PdfTextAnnotation - The newly created PdfTextAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddStrikeOut

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

Adds a strikeout annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the strikeout area in points.
yfloatThe y coordinate of the strikeout area in points.
widthfloatThe width of the strikeout area in points.
heightfloatThe height of the strikeout area in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfStrikeOutAnnotation - The newly created PdfStrikeOutAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

AddUnderline

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

Adds an underline annotation to this page.

Parameters

NameTypeDescription
xfloatThe x coordinate of the underline area in points.
yfloatThe y coordinate of the underline area in points.
widthfloatThe width of the underline area in points.
heightfloatThe height of the underline area in points.
authorstringThe author of the annotation.
contentsstringThe text contents/comment for the annotation.

Returns: PdfUnderlineAnnotation - The newly created PdfUnderlineAnnotation. Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the operation fails.

RemoveAt

public void RemoveAt(int index)

Removes the annotation at the specified index.

Parameters

NameTypeDescription
indexintThe 0-based index of the annotation to remove.

Throws: NutrientException - Thrown when no page is loaded.

Throws: NutrientException - Thrown when the index is out of range.

Throws: NutrientException - Thrown when the operation fails.

Resource management

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.