Namespace IronPdf.Annotations
Classes
PdfAnnotation
Base PDF annotation
PdfAnnotationCollection
Manages the collection of annotations (sticky notes, comments) in a PDF document. Supports adding, removing, and iterating through annotations across all pages.
Access via Annotations property. Changes to the collection are automatically synchronized with the PDF document.
Example - Work with annotations:
var pdf = PdfDocument.FromFile("document.pdf");
// Add annotation to first page:
var note = new TextAnnotation(0)
{
Title = "Review Note",
Contents = "Please verify this section",
X = 100,
Y = 700
};
pdf.Annotations.Add(note);
// List all annotations:
foreach (var annotation in pdf.Annotations)
Console.WriteLine($"Page {annotation.PageIndex}: {annotation.Contents}");
// Remove annotations from page 2:
pdf.Annotations.RemoveAllAnnotationsForPage(1);
// Clear all annotations:
pdf.Annotations.Clear();
pdf.SaveAs("annotated.pdf");
PdfAnnotationType
PdfFreeTextAnnotation
PDF free annotation
PdfLinkAnnotation
PDF link annotation
PdfTextAnnotation
PDF text annotation
TextAnnotation
Creates interactive sticky-note annotations for PDF documents - like Post-it® notes for digital documents. Perfect for comments, review feedback, and collaborative document workflows.
// Add simple comment:
var comment = new TextAnnotation(0, "Review", "Please check figures") {
X = 100, Y = 100,
Color = Color.Yellow
};
pdf.Annotations.Add(comment);
// Review annotation with metadata:
var review = new TextAnnotation(pageIndex: 0) {
Title = "John Smith",
Subject = "Technical Review",
Contents = "Algorithm needs optimization",
X = 300, Y = 500,
Color = Color.Red,
OpenByDefault = true
};
pdf.Annotations.Add(review);
// Hidden annotation for metadata:
var metadata = new TextAnnotation(0, "Version", "v2.1.0") {
Hidden = true,
Printable = false
};
pdf.Annotations.Add(metadata);Annotations appear as icons that expand to show full text
Some PDF viewers may not respect all properties
See: https://ironpdf.com/how-to/annotations/
TextAnnotation.AnnotationIcon
Icons used to interact with (open/close) the annotation with the PDF page.
Interfaces
IAnnotation
PDF document annotation