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

IAC C# using GetAnnotIndex and GetAnnot Method

Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

How can I find the index of an annotation ? 

int annotIndex = pDPage.GetAnnotIndex(pDAnnot);

 

For getting the pDAnnot, we need to specify the index before hand 

pDAnnot = (CAcroPDAnnot)pDPage.GetAnnotIndex(annotIndex);

Feels like a closed loop. Any idea on how to get AnnotationIndex

 

TOPICS
Acrobat SDK and JavaScript , Windows

Views

55

Likes

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 ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

Use a loop over all annotations.

Likes

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
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

NOTE : There is an error in the code in above Q . Below is the correct code.

pDAnnot = (CAcroPDAnnot)pDPage.GetAnnot(annotIndex);

Coing back to  discussion , how can I do that ?

pDAnnot is not iterable in this specific case as it fetches single pDAnnot Object.

However, I can do a loop like this, but i see no upside to it.

for (int i = 0; i < pDPage.GetNumAnnots(); i++)
{
   pDAnnot = (CAcroPDAnnot)pDPage.GetAnnot(i);
   int j = pDPage.GetAnnotIndex(pDAnnot);
   // j & i will be same
}

 

Its like,

For getting annotation object (pDAnnot) you need to provide anootationIndex .

For getting anootationIndex , you need to provide ano\notation object(pDAnnot)

Am I missing something here ?

Likes

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 ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

For what annotation want you the index?

Likes

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
Jul 29, 2022 Jul 29, 2022

Copy link to clipboard

Copied

I need to get index of checkboxe annotation(or fields?)

Likes

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 ,
Jul 29, 2022 Jul 29, 2022

Copy link to clipboard

Copied

LATEST

Form fields are not annotations.

Likes

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