How to remove Rubber stamp like Area & linear using annotation.popPath();

PDF.js Express Version
7.3.1

Detailed description of issue
On some action I able to remove that last added point of AnnotationCreateAreaMeasurement and AnnotationCreatePerimeterMeasurement by using below code snippet.

annotation.popPath()

Now I want to do the same scenario for rubber stamp - I will be getting that annotation object and then remove by popPath()
image
Expected behaviour
I should be able to remove that added rubber stamp. [Not by using delete]

Code snippet

const currentTool = this.viewerInstance.getToolMode();
if (currentTool.annotation && currentTool.annotation.popPath) {
        currentTool.annotation.popPath();
}

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Any updates on above issue?

Hi Kiran,

It is not possible to use popPath() on a Stamp Annotation. This is because popPath removes the last line segment of an annotation. Since the Stamp Annotation contains no line segments/paths it can not extend the functionality of popPath. To remove a Stamp Annotation I recommend using the deleteAnnotation API like so:
instance.annotManager.deleteAnnotation(annotation)

Cheers,
Dustin