Highlight annotation is not getting deleted from Comment list
Hello,
When I delete annotation using PDPageRemoveAnnot method, it deletes the annotation from the page successfully.
But when I look at the comment tab, it still remains there.
Here is my code snipet to find and delete required highlight annotation:
for (int i2 = 0; i2 < PDPageGetNumAnnots(page); i2++) {
//Get a specific annotation
annot = PDPageGetAnnot(page, i2);
if (PDAnnotIsValid(annot)){
//Determine if the annotation is a Highlight annotation
if (PDAnnotGetSubtype(annot) == ASAtomFromString("Highlight")) {
//Create a character pointer to store the annotation's text
char * annBuf;
ASInt32 bufSize = PDTextAnnotGetContents(annot, NULL, 0) + 1;
//Allocate the size of bufSize to the character pointer
annBuf = (char*)ASmalloc((os_size_t)bufSize);
//Populate annBuf with the annotation's text
PDTextAnnotGetContents(annot, annBuf, bufSize);
//Compare the contents of annBuf with a string
if (strcmp(annBuf, ident) == 0){
annotPageNum = i;
ASFixedRect frect;
PDAnnotGetRect(annot, &frect);
PDPageRemoveAnnot(page, PDPageGetAnnotIndex(page, annot));
break;
}
}
}
}
Can you please help what am missing here?
Thank you in advance!
