Syncfusion AI Assistant

How can I help you?

Undo and Redo Annotations in ASP.NET Core PDF Viewer

27 Apr 20261 minute to read

The ASP.NET Core PDF Viewer supports undo and redo operations for annotations.

Undo-redo

Undo and redo actions can be performed by using either of the following methods:

  1. Using keyboard shortcuts (desktop):
    After performing an annotation action, press Ctrl+Z to undo and Ctrl+Y to redo on Windows and Linux. On macOS, use Command+Z to undo and Command+Shift+Z to redo.
  2. Using the toolbar:
    Use the Undo and Redo tools in the toolbar.

Refer to the following code snippet to call undo and redo actions from the client side.

<div style="width:100%;height:600px">
    <ejs-pdfviewer id="pdfviewer"
                   style="height:600px"
                   documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
                   resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib">
    </ejs-pdfviewer>
</div>

<script>
    function getViewer() {
        return document.getElementById('pdfviewer').ej2_instances[0];
    }

    function undoAnnotation() {
        getViewer().undo();
    }

    function redoAnnotation() {
        getViewer().redo();
    }
</script>

See also