GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / GetAnnotationActionID Method
The 0-based index of the required annotation within the current page. It must be a value from 0 to GdPicturePDF.GetAnnotationCount-1.
Example





In This Topic
GetAnnotationActionID Method (GdPicturePDF)
In This Topic
Returns the action's unique identifier of the action associated with an annotation object, that is specified by its index related to the currently selected page of the loaded PDF document. You can subsequently use the GdPicturePDF.GetActionType method to determine the kind of this action.

At this time it is supported by the toolkit to only associate one action within one annotation object.

Syntax
'Declaration
 
Public Function GetAnnotationActionID( _
   ByVal AnnotationIdx As Integer _
) As Integer
public int GetAnnotationActionID( 
   int AnnotationIdx
)
public function GetAnnotationActionID( 
    AnnotationIdx: Integer
): Integer; 
public function GetAnnotationActionID( 
   AnnotationIdx : int
) : int;
public: int GetAnnotationActionID( 
   int AnnotationIdx
) 
public:
int GetAnnotationActionID( 
   int AnnotationIdx
) 

Parameters

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

Return Value

A unique action identifier of the action associated with a specified annotation object. The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.

You can use the GdPicturePDF.GetActionType method to obtain the type of this action, as it is shown in the example below.

Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GdPicturePDF.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 GdPicturePDF.SelectPage method before applying an annotation index.

Be aware that at this time it is not supported by the toolkit to add multiple actions per one annotation object.

Example
How to find out the types of actions associated with annotations on the first page of the PDF document.
Dim caption As String = "Example: GetAnnotationActionID"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If (gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK) AndAlso
   (gdpicturePDF.SelectPage(1) = GdPictureStatus.OK) Then
    Dim annotCount As Integer = gdpicturePDF.GetAnnotationCount()
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim message As String = "The number of annotations on the 1st page is: " + annotCount.ToString() + vbCrLf
        Dim actionID As Integer = -1
        Dim actionType As PdfActionType = PdfActionType.ActionTypeUnknown
        For annotID As Integer = 0 To annotCount - 1
            message = message + "annotID: " + annotID.ToString() + "  subtype: "
            Dim annotSubtype As String = gdpicturePDF.GetAnnotationSubType(annotID)
            If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                message = message + annotSubtype + "  action: "
                actionID = gdpicturePDF.GetAnnotationActionID(annotID)
                If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                    actionType = gdpicturePDF.GetActionType(actionID)
                    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                        message = message + actionType.ToString()
                    Else
                        message = message + gdpicturePDF.GetStat().ToString()
                    End If
                Else
                    message = message + gdpicturePDF.GetStat().ToString()
                End If
            Else
                message = message + gdpicturePDF.GetStat().ToString()
            End If
            message = message + vbCrLf
        Next
        MessageBox.Show(message, caption)
    Else
        MessageBox.Show("The GetAnnotationCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetAnnotationActionID";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if ((gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK) &&
    (gdpicturePDF.SelectPage(1) == GdPictureStatus.OK))
{
    int annotCount = gdpicturePDF.GetAnnotationCount();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        string message = "The number of annotations on the 1st page is: " + annotCount.ToString() + "\n";
        int actionID = -1;
        PdfActionType actionType = PdfActionType.ActionTypeUnknown;
        for (int annotID = 0; annotID < annotCount; annotID++)
        {
            message = message + "annotID: " + annotID.ToString() + "  subtype: ";
            string annotSubtype = gdpicturePDF.GetAnnotationSubType(annotID);
            if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            {
                message = message + annotSubtype + "  action: ";
                actionID = gdpicturePDF.GetAnnotationActionID(annotID);
                if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                {
                    actionType = gdpicturePDF.GetActionType(actionID);
                    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                        message = message + actionType.ToString();
                    else
                        message = message + gdpicturePDF.GetStat().ToString();
                }
                else
                    message = message + gdpicturePDF.GetStat().ToString();
            }
            else
                message = message + gdpicturePDF.GetStat().ToString();
            message = message + "\n";
        }
        MessageBox.Show(message, caption);
    }
    else
        MessageBox.Show("The GetAnnotationCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
    MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();
See Also