Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.25 KB

File metadata and controls

34 lines (26 loc) · 1.25 KB
layout post
title Delete an annotation in JavaScript PDF Viewer | Syncfusion
description Learn how to delete a specific annotation in the JavaScript PDF Viewer using the deleteAnnotationById method.
platform document-processing
control PDF Viewer
documentation ug
domainurl

Delete an annotation in JavaScript PDF Viewer

Use the deleteAnnotationById() method to remove a specific annotation from a PDF document by its id.

Steps to delete a specific annotation

Step 1: Follow the getting-started guide to create a simple PDF Viewer sample: Getting started with JavaScript PDF Viewer.

Step 2: Add a control to trigger deletion and use the following example to call deleteAnnotationById().

 <button id="deleteAnnotationbyId">Delete Annotation By Id</button>
// Delete Annotation by ID.
document.getElementById('deleteAnnotationbyId').addEventListener('click', () => {
    viewer.annotationModule.deleteAnnotationById(
      viewer.annotationCollection[0].annotationId
    );
  });

Sample: How to delete a specific annotation using deleteAnnotationById