Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Highlight annotation is not getting deleted from Comment list

New Here ,
Apr 20, 2017 Apr 20, 2017

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!

TOPICS
Acrobat SDK and JavaScript
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2017 Apr 20, 2017

Any updates on this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2017 Apr 20, 2017

What, after 2 hours??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2017 Apr 20, 2017

Sorry, but its urgent!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 20, 2017 Apr 20, 2017

In that case you need to pay somebody to solve your problem. The people you meet here in the forums are volunteering their time. We are not getting paid to help you with your problems, and we can therefore only do that once everything else is taken care of: Eating, sleeping, family, earning a living, ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2017 Apr 20, 2017

Then it would be best to raise a support case. I believe it is $200 to do this, please let us know if you find out how.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 20, 2017 Apr 20, 2017

PDPageRemoveAnnot() is the correct approach. If the annot isn’t removed from the list, then I would call that a bug n Acrobat/Reader. What version are you using?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2017 Apr 20, 2017

I am using 2017 Release (Continuous) | Version 2017.009.20044

I have downloaded it from Acrobat Creative Cloud.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2017 Apr 20, 2017

Now I have time to review your code I can see it will fail badly if there is more than one highlight annotation, because it has the classic bug "sitting on the tree branch to saw it off". Go through the Annots backwards.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2017 Apr 20, 2017

Hello Irosenth,

As you said, PDPageRemoveAnnot() is the correct approach. Comments are still there in comment list.

When I click on that comment box, the border area of the annotation that was deleted is highlighted.

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2017 Apr 20, 2017

As I said your code may not actually delete all annots  if there is more than one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2017 Apr 21, 2017

Thank you for your help.

I got the solution.

I used :

CosObj cosObj = PDAnnotGetCosObj(annot);

CosObjDestroy(cosObj);

after the PDPageRemoveAnnot() method.

It worked

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 21, 2017 Apr 21, 2017

Glad to hear it. I hope you also fixed the critical bug I identified.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2017 Apr 21, 2017
LATEST

Yes, Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines