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
Copy link to clipboard
Copied
Use a loop over all annotations.
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 ?
Copy link to clipboard
Copied
For what annotation want you the index?
I need to get index of checkboxe annotation(or fields?)
Copy link to clipboard
Copied
Form fields are not annotations.