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

IAC C# using GetAnnotIndex and GetAnnot Method

Jul 26, 2022 Jul 26, 2022

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

Use a loop over all annotations.

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

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 ?

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

For what annotation want you the index?

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

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

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

Form fields are not annotations.

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