How can I help you?
PdfPopupAnnotationCollection
21 Apr 20263 minutes to read
Represents the collection of PdfPopupAnnotation
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access annotation collection from first page
let annotations: PdfRectangleAnnotation = document.getPage(0).annotations;
// Gets the comments of annotation
let comments: PdfPopupAnnotationCollection = annotation.comments;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();Methods
add
Add a new popup annotation into the collection
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access first page
let page: PdfPage = document.getPage(0);
// Create a new popup annotation
const popupAnnotation: PdfPopupAnnotation = new PdfPopupAnnotation('Test popup annotation', 10, 40, 30, 30);
popupAnnotation.author = 'Syncfusion';
// Add a new popup annotation into the collection
annotation.comments.add(popupAnnotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();| Parameter | Type | Description |
|---|---|---|
| annotation | PdfPopupAnnotation |
Annotation to add |
Returns void
remove
Remove an annotation from the collection
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access annotation collection from first page
let annotations: PdfRectangleAnnotation = document.getPage(0).annotations;
// Gets the comments of annotation
let comments: PdfPopupAnnotationCollection = annotation.comments;
// Gets the first comment
let comment: PdfPopupAnnotation = comments.at(0);
// Remove the comment
comments.remove(comment);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();| Parameter | Type | Description |
|---|---|---|
| annotation | PdfPopupAnnotation |
Annotation to remove |
Returns void
removeAt
Remove an annotation from the collection at the specified index
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access annotation collection from first page
let annotations: PdfRectangleAnnotation = document.getPage(0).annotations;
// Gets the comments of annotation
let comments: PdfPopupAnnotationCollection = annotation.comments;
// Remove the first comment
comments.removeAt(0);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();| Parameter | Type | Description |
|---|---|---|
| index | number |
Annotation index to remove |
Returns void