Close the comment panel

17 Feb 20221 minute to read

The PDF Viewer server library allows you to close the comment panel programmatically using the external button event.

The following steps are used to close the comment panel programmatically in PDF Viewer,

Step 1: Follow the steps provided in the link to create simple PDF Viewer sample.

Step 2: Add the following code snippet to close the comment panel using button click event

<button type="button" onclick="closeCommentPanel()">CloseCommentPanel</button>

<script>
        function closeCommentPanel() {
            var viewer = document.getElementById('pdfviewer').ej2_instances[0];
            viewer.viewerBase.navigationPane.closeCommentPanelContainer();
        }

</script>

Download the sample how to close comment panel