Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / GetAnnotationType Method
The 0-based index of the required annotation within the current page. It must be a value from 0 to GetAnnotationCount-1.
Example





In This Topic
    GetAnnotationType Method (GdPicturePDF)
    In This Topic
    Returns the type of a required annotation object specified by its index related to the currently selected page of the loaded PDF document. It is always "Annot" for properly defined annotation object. Please use the GetAnnotationSubType method to find out the specific subtype of the required annotation object, as it is shown in the example below.
    Syntax
    'Declaration
     
    
    Public Function GetAnnotationType( _
       ByVal AnnotationIdx As Integer _
    ) As String
    public string GetAnnotationType( 
       int AnnotationIdx
    )
    public function GetAnnotationType( 
        AnnotationIdx: Integer
    ): String; 
    public function GetAnnotationType( 
       AnnotationIdx : int
    ) : String;
    public: string* GetAnnotationType( 
       int AnnotationIdx
    ) 
    public:
    String^ GetAnnotationType( 
       int AnnotationIdx
    ) 

    Parameters

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

    Return Value

    The type of the specified annotation object, if defined properly, must be "Annot". Specifically, the correct return value should be always "Annot". Please always use the GetStat method to determine if this method has been successful.
    Remarks
    Please note that this method is only allowed for use with non-encrypted documents.

    It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

    Please always ensure that you have selected the correct page using the SelectPage method before applying an annotation index.

    Just to remind you, that you need to use the GetAnnotationSubType method to find out the specific subtype of the required annotation object, as it is shown in the example below.

    Example
    How to find out the type and the subtype of all annotations included in the PDF document.
    Dim caption As String = "Example: GetAnnotationType"
    Dim oGdPicturePDF As New GdPicturePDF()
    Dim status As GdPictureStatus = oGdPicturePDF.LoadFromFile("test.pdf", False)
    If status = GdPictureStatus.OK Then
        Dim message As String = ""
        Dim pageCount As Integer = oGdPicturePDF.GetPageCount()
        For i As Integer = 1 To pageCount
            status = oGdPicturePDF.SelectPage(i)
            If status <> GdPictureStatus.OK Then
                message = message + "The SelectPage(" + i.ToString() + ") method has failed with the status: " + status.ToString() + vbCrLf
            Else
                message = message + "Page nr." + i.ToString() + ":" + vbCrLf
                Dim annotCount As Integer = oGdPicturePDF.GetAnnotationCount()
                status = oGdPicturePDF.GetStat()
                If status <> GdPictureStatus.OK Then
                    message = message + "The GetAnnotationCount() method has failed with the status: " + status.ToString() + vbCrLf
                Else
                    If annotCount = 0 Then
                        message = message + "This page does not contain any annotations." + vbCrLf
                    Else
                        Dim annotType As String = ""
                        Dim annotSubType As String = ""
                        For j As Integer = 0 To annotCount - 1
                            annotType = oGdPicturePDF.GetAnnotationType(j)
                            annotSubType = oGdPicturePDF.GetAnnotationSubType(j)
                            message = message + "Annot nr." + j.ToString() + ": Type = " + annotType + "    Subtype = " + annotSubType + vbCrLf
                        Next
                    End If
                End If
            End If
        Next
        MessageBox.Show(message, caption)
    Else
        MessageBox.Show("The file can't be loaded.", caption)
    End If
    oGdPicturePDF.Dispose()
    string caption = "Example: GetAnnotationType";
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    GdPictureStatus status = oGdPicturePDF.LoadFromFile("test.pdf", false);
    if (status == GdPictureStatus.OK)
    {
        string message = "";
        int pageCount = oGdPicturePDF.GetPageCount();
        for (int i = 1; i <= pageCount; i++)
        {
            status = oGdPicturePDF.SelectPage(i);
            if (status != GdPictureStatus.OK)
            {
                message = message + "The SelectPage(" + i.ToString() + ") method has failed with the status: " + status.ToString() + "\n";
            }
            else
            {
                message = message + "Page nr." + i.ToString() + ":\n";
                int annotCount = oGdPicturePDF.GetAnnotationCount();
                status = oGdPicturePDF.GetStat();
                if (status != GdPictureStatus.OK)
                {
                    message = message + "The GetAnnotationCount() method has failed with the status: " + status.ToString() + "\n";
                }
                else
                {
                    if (annotCount == 0)
                    {
                        message = message + "This page does not contain any annotations." + "\n";
                    }
                    else
                    {
                        string annotType = "";
                        string annotSubType = "";
                        for (int j = 0; j < annotCount; j++)
                        {
                            annotType = oGdPicturePDF.GetAnnotationType(j);
                            annotSubType = oGdPicturePDF.GetAnnotationSubType(j);
                            message = message + "Annot nr." + j.ToString() + ": Type = " + annotType + "    Subtype = " + annotSubType + "\n";
                        }
                    }
                }
            }
        }
        MessageBox.Show(message, caption);
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", caption);
    }
    oGdPicturePDF.Dispose();
    See Also