GetAnnotationSubType Method (GdPicturePDF)
Returns the subtype of a required annotation object specified by its index related to the currently selected page of the loaded PDF document.
public string GetAnnotationSubType(
int
)
public function GetAnnotationSubType(
: Integer
): String;
public function GetAnnotationSubType(
: int
) : String;
public: string* GetAnnotationSubType(
int
)
public:
String^ GetAnnotationSubType(
int
)
'Declaration
Public Function GetAnnotationSubType( _
ByVal As Integer _
) As String
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
The subtype of the specified annotation object as a string, for example "Popup", "Stamp", "Text" and others. Please refer to the Annotation Types naming convention in PDF Reference, Section "Annotation Types" for the proper subtype values.
The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
How to find out the type and the subtype of all annotations included in the PDF document.
Dim caption As String = "Example: GetAnnotationSubType"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim message As String = ""
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
For i As Integer = 1 To pageCount
status = gdpicturePDF.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 = gdpicturePDF.GetAnnotationCount()
status = gdpicturePDF.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 = gdpicturePDF.GetAnnotationType(j)
annotSubType = gdpicturePDF.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
gdpicturePDF.Dispose()
string caption = "Example: GetAnnotationSubType";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
string message = "";
int pageCount = gdpicturePDF.GetPageCount();
for (int i = 1; i <= pageCount; i++)
{
status = gdpicturePDF.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 = gdpicturePDF.GetAnnotationCount();
status = gdpicturePDF.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 = gdpicturePDF.GetAnnotationType(j);
annotSubType = gdpicturePDF.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);
}
gdpicturePDF.Dispose();