Dim caption As String = "Example: GetFormFieldCheckBoxStyle"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("forms.pdf", False) = GdPictureStatus.OK Then
Dim count As Integer = gdpicturePDF.GetFormFieldsCount()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim message As String = ""
Dim formID As Integer = 0
Dim hasRB As Boolean = False
Dim type As PdfFormFieldType = PdfFormFieldType.PdfFormFieldTypeUnknown
Dim style As PdfCheckBoxStyle = PdfCheckBoxStyle.PdfCheckBoxStyleCheck
For i As Integer = 0 To count - 1
formID = gdpicturePDF.GetFormFieldId(i)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
type = gdpicturePDF.GetFormFieldType(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If type = PdfFormFieldType.PdfFormFieldTypeRadioButton Then
hasRB = True
message = message + "RB " + gdpicturePDF.GetFormFieldTitle(formID)
style = gdpicturePDF.GetFormFieldCheckBoxStyle(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
'The style of the checkmark is the same for all child radio buttons in this group.
message = message + " - style: " + style.ToString()
Else
If gdpicturePDF.GetStat() = GdPictureStatus.Aborted Then
'The style of the checkmark is different for the individual child radio buttons in this group.
message = message + " has a different style for its child radio buttons."
Dim kids As Integer = gdpicturePDF.GetFormFieldChildCount(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
For j As Integer = 0 To kids - 1
message = message + vbCrLf + " " + j.ToString() + ".child - style: "
style = gdpicturePDF.GetFormFieldCheckBoxStyle(formID, j)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message = message + style.ToString()
Else
message = message + gdpicturePDF.GetStat().ToString()
End If
Next
Else
message = message + vbCrLf + " The GetFormFieldChildCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
End If
Else
message = message + vbCrLf + " The GetFormFieldCheckBoxStyle() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
End If
End If
End If
Else
MessageBox.Show("The GetFormFieldType() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
Exit For
End If
Else
MessageBox.Show("The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
Exit For
End If
message += vbCrLf
Next
If count = 0 Then
message = "This file doesn't include forms."
ElseIf Not hasRB Then
message = "This file doesn't include radio button form fields."
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("The GetFormFieldsCount() 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: GetFormFieldCheckBoxStyle";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetFormFieldsCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
string message = "";
int formID = 0;
bool hasRB = false;
PdfFormFieldType type = PdfFormFieldType.PdfFormFieldTypeUnknown;
PdfCheckBoxStyle style = PdfCheckBoxStyle.PdfCheckBoxStyleCheck;
for (int i = 0; i < count; i++)
{
formID = gdpicturePDF.GetFormFieldId(i);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
type = gdpicturePDF.GetFormFieldType(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (type == PdfFormFieldType.PdfFormFieldTypeRadioButton)
{
hasRB = true;
message = message + "RB " + gdpicturePDF.GetFormFieldTitle(formID);
style = gdpicturePDF.GetFormFieldCheckBoxStyle(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
//The style of the checkmark is the same for all child radio buttons in this group.
message = message + " - style: " + style.ToString();
}
else
{
if (gdpicturePDF.GetStat() == GdPictureStatus.Aborted)
{
//The style of the checkmark is different for the individual child radio buttons in this group.
message = message + " has a different style for its child radio buttons.";
int kids = gdpicturePDF.GetFormFieldChildCount(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
for (int j = 0; j < kids; j++)
{
message = message + "\n " + j.ToString() + ".child - style: ";
style = gdpicturePDF.GetFormFieldCheckBoxStyle(formID, j);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
message = message + style.ToString();
else
message = message + gdpicturePDF.GetStat().ToString();
}
}
else message = message + "\n The GetFormFieldChildCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
}
else message = message + "\n The GetFormFieldCheckBoxStyle() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
}
}
}
else
{
MessageBox.Show("The GetFormFieldType() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
break;
}
}
else
{
MessageBox.Show("The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
break;
}
message += "\n";
}
if (count == 0) message = "This file doesn't include forms.";
else if (!hasRB) message = "This file doesn't include radio button form fields.";
MessageBox.Show(message, caption);
}
else
MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();