PdfAnnotationCollection
12 Sep 20251 minute to read
The class provides methods and properties to handle the collection of PdfAnnotation.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access annotation coolection from first page
let annotations: PdfAnnotationCollection = document.getPage(0).annotations;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();Properties
count number
Gets the annotation count (Read only).
Methods
add
Add a new PdfAnnotation into the collection.
| Parameter | Type | Description |
|---|---|---|
| annotation | PdfAnnotation |
Annotation to add. |
Returns number
at
Gets the PdfAnnotation at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Field index. |
Returns PdfAnnotation
remove
Remove an annotation from the collection.
| Parameter | Type | Description |
|---|---|---|
| annotation | PdfAnnotation |
Annotation to remove. |
Returns void
removeAt
Remove an annotation from the collection at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Annotation index. |
Returns void