Documents for PDF .NET Edition
GrapeCity Documents PDF Viewer / Edit PDF / Comments Tool
In This Topic
    Comments Tool
    In This Topic

    GcDocs PDF Viewer provides users with the ability to add text annotations and their replies as comments in PDF documents. These comments are very useful to hold some discussion, ask questions or add important information. The Comments tool can be used to add replies to text annotations in comments panel, add sticky notes to the document, view all comments in comments panel, edit or delete comments and assign their review status.

    Once a text annotation is added to a document, it can be viewed in the comments panel to add a reply to it as shown below:

    PDF Viewer displaying how to add and reply to comments in PDF documents

    Once the comments panel is visible, users can see all the text annotations and their replies. To view the comments panel, choose either of the following:

    PDF Viewer displaying comments panel

    Besides the comments panel, these replies are also visible below the original text annotation in the PDF document.

    Enable Comments Tool

    The Comments tool is hidden by default. However, it can be enabled by using addReplyTool method as shown below:

    Copy Code

    The Comments tool can also be enabled in expanded state which displays the comments panel, by default. The below code can be used for the same:

    Copy Code

    Note: To use Comments tool, SupportApi should be configured (as it allows editing a PDF document). The tool will work in read-only mode if SupportApi is not configured. The read-only mode is particularly useful to view all comments in comments panel.

    Set Author Name for Text Annotations

    While replying to a text annotation, the author name is displayed as 'Anonymous' by default. However, the desired author name can be set in following ways:

    Note: If author's name is set in both API and annotation editor, the author name defined in API is given priority.

    Modify or Delete Text Annotations

    A text annotation or reply can be edited by clicking on it in the comments panel as shown below:

    Edit comments in PDF Viewer

    A text annotation or reply can be deleted by clicking on Actions | Delete

    Delete comments in PDF Viewer

    Note: To delete the parent annotation and retain its replies, use the properties panel of Annotation Editor on the left sidebar. Otherwise, all its replies are removed as well.

    Add Review Status to Text Annotations

    You can also add review status to a text annotation in the comments panel by clicking on Actions | Status:

    Add review status for comments in PDF Viewer

    The status is added as an icon to the comment and displays assignee's name when hovered upon. The review status is also visible in the PDF document below the original comment. A user can assign only 1 status to a text annotation but multiple users can assign status to a text annotation.

    You can also assign status for a text annotation programmatically, by setting following properties: 'title' 'state', 'stateModel', 'referenceType', 'referenceAnnotationId'. The below example code shows how to add a reply to text annotation with id '6R' and assign 'Completed' status:

    Copy Code
    function addCompletedStatus() {
        viewer.findAnnotations("6R").then(function (searchResult) {
            var userName = "Jane Donahue";
            var replyAnnotation = viewer.cloneAnnotation(searchResult[0].annotation);
            replyAnnotation.title = userName;
            replyAnnotation.stateModel = 'Review';
            replyAnnotation.state = 'Completed';
            replyAnnotation.referenceType = 'R';
            replyAnnotation.referenceAnnotationId = '6R';
            replyAnnotation.contents = 'Status Completed set by ' + userName;
            viewer.addAnnotation(0, replyAnnotation);

    Add Sticky Note

    You can also add a sticky note anywhere in the PDF document by using context menu. Once it is added, enter some text and click 'Done' in its built-in text editor to retain the note.

    Add sticky notes in PDF Viewer

    You can also add replies to it, set author name, modify or delete a note and assign its review status in the comments panel.

    Note: Sticky note is enabled in the context menu only when Comments tool is enabled.