Dim caption As String = "Example: FormFieldHasBorderColor"
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 borderColor As Color = Color.Black
Dim hasColor As Boolean = False
Dim status As GdPictureStatus = GdPictureStatus.OK
For i As Integer = 0 To count - 1
message = message + i.ToString() + ".field: "
formID = gdpicturePDF.GetFormFieldId(i)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
hasColor = gdpicturePDF.FormFieldHasBorderColor(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message = message + "has borderColor: " + hasColor.ToString()
If hasColor Then
borderColor = gdpicturePDF.GetFormFieldBorderColor(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message = message + " borderColor: " + borderColor.ToString()
Else
message = message + " borderColor: " + gdpicturePDF.GetStat().ToString()
End If
Else
If gdpicturePDF.SetFormFieldBorderColor(formID, Color.Fuchsia) = GdPictureStatus.OK Then
message = message + " color set to: " + Color.Fuchsia.ToString()
Else
message = message + " color set to: " + gdpicturePDF.GetStat().ToString()
End If
End If
Else
message = message + gdpicturePDF.GetStat().ToString()
End If
status = GdPictureStatus.OK
Else
MessageBox.Show("The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
status = GdPictureStatus.Aborted
Exit For
End If
message += vbCrLf
Next
If status = GdPictureStatus.OK Then
If count = 0 Then
MessageBox.Show("This file doesn't include forms.", caption)
Else
If gdpicturePDF.SaveToFile("forms_updated.pdf") = GdPictureStatus.OK Then
message = message + "The example has been followed successfully and the file has been saved."
Else
message = message + "The file can't be saved."
End If
MessageBox.Show(message, caption)
End If
End If
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: FormFieldHasBorderColor";
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;
Color borderColor = Color.Black;
bool hasColor = false;
GdPictureStatus status = GdPictureStatus.OK;
for (int i = 0; i < count; i++)
{
message = message + i.ToString() + ".field: ";
formID = gdpicturePDF.GetFormFieldId(i);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
hasColor = gdpicturePDF.FormFieldHasBorderColor(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
message = message + "has borderColor: " + hasColor.ToString();
if (hasColor)
{
borderColor = gdpicturePDF.GetFormFieldBorderColor(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
message = message + " borderColor: " + borderColor.ToString();
else
message = message + " borderColor: " + gdpicturePDF.GetStat().ToString();
}
else
{
if (gdpicturePDF.SetFormFieldBorderColor(formID, Color.Fuchsia) == GdPictureStatus.OK)
message = message + " color set to: " + Color.Fuchsia.ToString();
else
message = message + " color set to: " + gdpicturePDF.GetStat().ToString();
}
}
else
message = message + gdpicturePDF.GetStat().ToString();
status = GdPictureStatus.OK;
}
else
{
MessageBox.Show("The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
status = GdPictureStatus.Aborted;
break;
}
message += "\n";
}
if (status == GdPictureStatus.OK)
{
if (count == 0)
MessageBox.Show("This file doesn't include forms.", caption);
else
{
if (gdpicturePDF.SaveToFile("forms_updated.pdf") == GdPictureStatus.OK)
message = message + "The example has been followed successfully and the file has been saved.";
else
message = message + "The file can't be saved.";
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();