- Adding a comment to the annotation
- How to check the comments added by the user
Contact Support
Comments in Angular PDF Viewer control
The PDF Viewer control provides options to add, edit, and delete comments for the following annotations in PDF documents:
- Shape annotation
- Stamp annotation
- Sticky note annotation
- Measurement annotation
- Text markup annotation
- Free text annotation
- Ink annotation

Adding a comment to the annotation
Annotation comments, replies, and status can be managed in the PDF document using the comment panel.
Comment panel
Annotation comments can be added to the PDF using the comment panel. The comment panel can be opened in the following ways:
-
Using the annotation menu
- Click the Edit Annotation button in the PDF Viewer toolbar. A toolbar appears below it.
- Click the Comment Panel button. The comment panel opens.
-
Using Context menu
- Select the annotation in the PDF document and right-click it.
- Select Comment from the context menu..
-
Using the Mouse click
- Select the annotation in the PDF document and double-click it. The comment panel opens.
If the comment panel is already open, select the annotation and add comments using the panel.
Adding comments
- Select the annotation in the PDF document.
- The corresponding comment thread is highlighted in the comment panel.
- Add comments and replies using the comment panel.

Adding Comment Replies
- Multiple replies can be added to a comment.
- After adding a comment, add replies as needed.
Adding Comment or Reply Status
- Select the annotation comment in the comment panel.
- Click More options in the comment or reply container.
- Select Set Status from the context menu.
- Choose a status for the comment.

Editing the comments and comments replies of the annotations
Comments, replies, and status can be edited using the comment panel.
Editing the Comment or Comment Replies
Edit comments and replies in the following ways:
-
Using the Context menu
- Select the annotation comment in the comment panel.
- Click More options in the comment or reply container.
- Select Edit from the context menu.
- An editable text box appears. Change the content of the comment or reply.
-
Using the Mouse Click
- Select the annotation comment in the comment panel.
- Double-click the comment or reply content.
- An editable text box appears. Change the content of the comment or reply.
Editing Comment or Reply Status
- Select the annotation comment in the comment panel.
- Click More options in the comment or reply container.
- Select Set Status from the context menu.
- Choose a status for the comment.
- None is the default state. Selecting None clears the status indicator; the comment or reply remains visible.

Delete Comment or Comment Replies
- Select the annotation comment in the comment panel.
- Click More options in the comment or reply container.
- Select Delete from the context menu.

Deleting the root comment from the comment panel also deletes the associated annotation.
How to check the comments added by the user
Comments added to the PDF document can be read using the annotation’s comments property.
The following example logs comments in response to a button click.
```html
<button (click)="checkComments()">Check the Comments</button>
<!--Render PDF Viewer component-->
<ejs-pdfviewer id="pdfViewer"
[documentPath]='document'
style="height:640px;display:block">
</ejs-pdfviewer>
``````html
<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);
}
}