GdPicture.NET Reference Guide
GetAnnotationFromIdx Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : GetAnnotationFromIdx Method
The 0-based index of the required annotation within the current page of the displayed document. It must be a value from 0 to GetAnnotationCount-1.
Returns a required GdPicture/XMP annotation object specified by its index related to the current page of the document displayed in the GdViewer control.

Be aware that this method only handles GdPicture/XMP annotations.

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 current page of the displayed 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. Please always use the GetStat method to determine if this method has been successful.
Remarks
We strongly recommend using the GetStat method to identify the specific reason for the method's failure.

Please note that this method expects to have the GdPicture XMP/Annotations Plugin to be unlocked. The method only handles GdPicture/XMP annotations as well.

Be aware that annotations are always treated relative to the currently displayed page.

Example
How to get the required annotation object specified by its index within the current page.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
Dim annotCount As Integer = GdViewer1.GetAnnotationCount()
Dim message As String = "The number of GdPicture/XMP annotations on the current page: " + annotCount
Dim annot As GdPicture14.Annotations.Annotation = Nothing
For i As Integer = 0 To annotCount - 1
    annot = GdViewer1.GetAnnotationFromIdx(i)
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        message = message + vbCrLf + i + "." + annot.Tag + " -  Author: " + annot.Author + "  Created: " + annot.CreationTime.ToString() + "  Subject: " + annot.Subject
    Else
        message = message + vbCrLf + i + ". - " + GdViewer1.GetStat().ToString()
    End If
Next
MessageBox.Show(message, "GdViewer.GetAnnotationFromIdx")
//We assume that the GdViewer1 control has been properly integrated
//and your document has been properly displayed as well.
int annotCount = GdViewer1.GetAnnotationCount();
string message = "The number of GdPicture/XMP annotations on the current page: " + annotCount;
GdPicture14.Annotations.Annotation annot = null;
for (int i = 0; i < annotCount; i++)
{
    annot = GdViewer1.GetAnnotationFromIdx(i);
    if (GdViewer1.GetStat() == GdPictureStatus.OK)
        message = message + "\n" + i + "." + annot.Tag + " -  Author: " + annot.Author + "  Created: " + annot.CreationTime + "  Subject: " + annot.Subject;
    else
        message = message + "\n" + i + ". - " + GdViewer1.GetStat().ToString();
}
MessageBox.Show(message, "GdViewer.GetAnnotationFromIdx");
See Also

Reference

GdViewer Class
GdViewer Members
GetAnnotationCount Method
GetSelectedAnnotationIdx Method
SelectAnnotation Method
DeleteAnnotation Method
GetAnnotationManager Method