The PDF Viewer control provides options to add, edit, and delete the comments to the following annotation in the PDF documents:
Annotation comment, comment replies, and status can be added to the PDF document using the comment panel.
Annotation comments can be added to the PDF using the comment panel. The comment panel can be opened in the following ways:
If the comment panel is already in the open state, you can select the annotations and add annotation comments using the comment panel.
The comment, comment replies, and status of the annotation can be edited using the comment panel.
The annotation comment and comment replies can be edited in the following ways:
The annotation will be deleted on deleting the comment using comment panel.
The comments added to the PDF document can be viewed by using the comments
property of the annotation.
Refer to the following code to check the comments added in the PDF document using a button click event.
<button (click)="checkComments()">Check the Comments</button>
<!--Render PDF Viewer component-->
<ejs-pdfviewer id="pdfViewer"
[serviceUrl]='service'
[documentPath]='document'
style="height:640px;display:block">
</ejs-pdfviewer>
//Method to check the comments added in the PDF document.
checkComments(){
var pdfviewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0];
var annotationCollections = pdfviewer.annotationCollection;
for (var x = 0; x < annotationCollections.length; x++) {
//Prints the annotation id in the console window.
console.log(annotationCollections[x].annotationId);
var comments = annotationCollections[x].comments;
for (var y = 0; y < comments.length; y++) {
var comment = comments[y];
//Prints the PDF document's comments in the console window.
console.log("comment" + "[" + y + "] :" + comment.note);
}
var note = annotationCollections[x].note;
console.log("note : " + note);
}
}