The 0-based index of the required annotation within the selected page of the handled document. It must be a value from 0 to GetAnnotationCount-1.
Example





In This Topic
GdPicture14 Namespace / AnnotationManager Class / GetAnnotationFromIdx Method

GetAnnotationFromIdx Method (AnnotationManager)

In This Topic
Returns a required GdPicture/XMP annotation object specified by its index related to the selected page of the document currently handled by this AnnotationManager object.

Be aware that this method only handles GdPicture/XMP annotations. Likewise, annotations are always treated relative to the selected page.

Syntax
'Declaration
 
Public Function GetAnnotationFromIdx( _
   ByVal AnnotationIdx As Integer _
) As Annotation
public Annotation GetAnnotationFromIdx( 
   int AnnotationIdx
)
public function GetAnnotationFromIdx( 
    AnnotationIdx: Integer
): Annotation; 
public function GetAnnotationFromIdx( 
   AnnotationIdx : int
) : Annotation;
public: Annotation* GetAnnotationFromIdx( 
   int AnnotationIdx
) 
public:
Annotation^ GetAnnotationFromIdx( 
   int AnnotationIdx
) 

Parameters

AnnotationIdx
The 0-based index of the required annotation within the selected page of the handled document. It must be a value from 0 to GetAnnotationCount-1.

Return Value

The required GdPicture/XMP annotation object of the type GdPicture14.Annotations.Annotation. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Please ensure that you have selected the proper page before starting any annotation related action with the handled document. Annotations are always treated relative to the currently selected page.

Example
How to get the required annotation object specified by its index within the selected page.
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (gdpicturePDF.LoadFromFile("annots.pdf", False) = GdPictureStatus.OK) AndAlso
   (annotationManager.InitFromGdPicturePDF(gdpicturePDF) = GdPictureStatus.OK) Then
    For p As Integer = 1 To gdpicturePDF.GetPageCount()
        If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
            Dim annot As GdPicture14.Annotations.Annotation = Nothing
            Dim annotCount As Integer = annotationManager.GetAnnotationCount()
            For i As Integer = 0 To annotCount - 1
                annot = annotationManager.GetAnnotationFromIdx(i)
                If (annotationManager.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
                    annot.Tag = "changed by GdPicture"
                Else
                    Exit For
                End If
            Next
            If annotationManager.GetStat() = GdPictureStatus.OK Then
                If annotationManager.SaveAnnotationsToPage() <> GdPictureStatus.OK Then Exit For
            End If
        Else
            Exit For
        End If
    Next
    If (annotationManager.GetStat() = GdPictureStatus.OK) AndAlso
       (annotationManager.SaveDocumentToPDF("annots_changed.pdf") = GdPictureStatus.OK) Then MessageBox.Show("Finished successfully!", "AnnotationManager.InitFromGdPicturePDF")
    If annotationManager.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("The example has failed. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromGdPicturePDF")
    annotationManager.Close()
Else
    MessageBox.Show("Objects can't be initialized properly.", "AnnotationManager.InitFromGdPicturePDF")
End If
annotationManager.Dispose()
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
AnnotationManager annotationManager = new AnnotationManager();
if ((gdpicturePDF.LoadFromFile("annots.pdf", false) == GdPictureStatus.OK) &&
    (annotationManager.InitFromGdPicturePDF(gdpicturePDF) == GdPictureStatus.OK))
{
    for (int p = 1; p <= gdpicturePDF.GetPageCount(); p++)
    {
        if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
        {
            GdPicture14.Annotations.Annotation annot = null;
            int annotCount = annotationManager.GetAnnotationCount();
            for (int i = 0; i < annotCount; i++)
            {
                annot = annotationManager.GetAnnotationFromIdx(i);
                if ((annotationManager.GetStat() == GdPictureStatus.OK) && (annot != null))
                {
                    annot.Tag = "changed by GdPicture";
                }
                else break;
            }
            if (annotationManager.GetStat() == GdPictureStatus.OK)
                if (annotationManager.SaveAnnotationsToPage() != GdPictureStatus.OK) break;
        }
        else break;
    }
    if ((annotationManager.GetStat() == GdPictureStatus.OK) &&
        (annotationManager.SaveDocumentToPDF("annots_changed.pdf") == GdPictureStatus.OK))
            MessageBox.Show("Finished successfully!", "AnnotationManager.GetAnnotationFromIdx");
    if (annotationManager.GetStat() != GdPictureStatus.OK)
        MessageBox.Show("The example has failed. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFromIdx");
    annotationManager.Close();
}
else
    MessageBox.Show("Objects can't be initialized properly.", "AnnotationManager.GetAnnotationFromIdx");
annotationManager.Dispose();
gdpicturePDF.Dispose();
See Also