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

Highlight annotation is not getting deleted from Comment list

New Here ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

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

Views

761

Translate

Translate

Report

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

Copy link to clipboard

Copied

Any updates on this?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

What, after 2 hours??

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Sorry, but its urgent!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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, ...

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

I am using 2017 Release (Continuous) | Version 2017.009.20044

I have downloaded it from Acrobat Creative Cloud.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank you for your help.

I got the solution.

I used :

CosObj cosObj = PDAnnotGetCosObj(annot);

CosObjDestroy(cosObj);

after the PDPageRemoveAnnot() method.

It worked

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

Yes, Thank you!

Votes

Translate

Translate

Report

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