GetAnnotationActionID Method (GdPicturePDF)
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.
public int GetAnnotationActionID(
int
)
public function GetAnnotationActionID(
: Integer
): Integer;
public function GetAnnotationActionID(
: int
) : int;
public: int GetAnnotationActionID(
int
)
public:
int GetAnnotationActionID(
int
)
'Declaration
Public Function GetAnnotationActionID( _
ByVal As Integer _
) As Integer
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.
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();