GdPicture.NET.14.API
GdPicture14 Namespace / AnnotationManager Class / GetAnnotationType Method
The 0-based index of the required annotation within the selected page of the handled document. It must be a value from 0 to AnnotationManager.GetAnnotationCount-1.
Example





In This Topic
GetAnnotationType Method (AnnotationManager)
In This Topic
Returns the type of 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 GetAnnotationType( _
   ByVal AnnotationIdx As Integer _
) As Annotation.GdPictureAnnotationType
public Annotation.GdPictureAnnotationType GetAnnotationType( 
   int AnnotationIdx
)
public function GetAnnotationType( 
    AnnotationIdx: Integer
): Annotation.GdPictureAnnotationType; 
public function GetAnnotationType( 
   AnnotationIdx : int
) : Annotation.GdPictureAnnotationType;
public: Annotation.GdPictureAnnotationType GetAnnotationType( 
   int AnnotationIdx
) 
public:
Annotation.GdPictureAnnotationType GetAnnotationType( 
   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 AnnotationManager.GetAnnotationCount-1.

Return Value

A member of the GdPictureAnnotationType enumeration. The AnnotationManager.GetStat method can be subsequently used to determine if this method has been successful.
Remarks
It is recommend to use the AnnotationManager.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 determine the type of the specified annotation.
Using annotationManager As AnnotationManager = New AnnotationManager()
    If annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK Then
        For p As Integer = 1 To annotationManager.PageCount
            If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
                Dim annotCount As Integer = annotationManager.GetAnnotationCount()
                If annotationManager.GetStat() = GdPictureStatus.OK Then
                    For a As Integer = 0 To annotCount - 1
                        Dim type As GdPicture14.Annotations.Annotation.GdPictureAnnotationType = annotationManager.GetAnnotationType(a)
                        If annotationManager.GetStat() = GdPictureStatus.OK Then
                            If type = GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeRubberStamp Then
                                Dim annot As GdPicture14.Annotations.Annotation = annotationManager.GetAnnotationFromIdx(a)
                                If annot IsNot Nothing Then
                                    If annot.Visible Then annot.Rotation = 45
                                End If
                            End If
                        End If
                    Next
                    If annotationManager.GetStat() = GdPictureStatus.OK Then annotationManager.SaveAnnotationsToPage()
                    If annotationManager.GetStat() <> GdPictureStatus.OK Then Exit For
                Else
                    Exit For
                End If
            Else
                Exit For
            End If
        Next
        If annotationManager.GetStat() = GdPictureStatus.OK Then
            If annotationManager.SaveDocumentToPDF("dest.pdf") = GdPictureStatus.OK Then
                MessageBox.Show("Done!", "AnnotationManager.GetAnnotationType")
            Else
                MessageBox.Show("The document can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType")
            End If
        Else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType")
        End If
        annotationManager.Close()
    Else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType")
    End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
    if (annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK)
    {
        for (int p = 1; p <= annotationManager.PageCount; p++)
        {
            if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
            {
                int annotCount = annotationManager.GetAnnotationCount();
                if (annotationManager.GetStat() == GdPictureStatus.OK)
                {
                    for (int a = 0; a < annotCount; a++)
                    {
                        GdPicture14.Annotations.Annotation.GdPictureAnnotationType type = annotationManager.GetAnnotationType(a);
                        if (annotationManager.GetStat() == GdPictureStatus.OK)
                        {
                            if (type == GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeRubberStamp)
                            {
                                GdPicture14.Annotations.Annotation annot = annotationManager.GetAnnotationFromIdx(a);
                                if (annot != null)
                                {
                                    if (annot.Visible) annot.Rotation = 45;
                                }
                            }
                        }
                    }
                    if (annotationManager.GetStat() == GdPictureStatus.OK)
                        annotationManager.SaveAnnotationsToPage();
                    if (annotationManager.GetStat() != GdPictureStatus.OK) break;
                }
                else break;
            }
            else break;
        }
        if (annotationManager.GetStat() == GdPictureStatus.OK)
        {
            if (annotationManager.SaveDocumentToPDF("dest.pdf") == GdPictureStatus.OK)
                MessageBox.Show("Done!", "AnnotationManager.GetAnnotationType");
            else
                MessageBox.Show("The document can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType");
        }
        else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType");
        annotationManager.Close();
    }
    else
        MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationType");
}
See Also