Dim caption As String = "Example: GetFormFieldRequired"
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 = ""
If count = 0 Then
message = "This document does not contain any forms."
Else
Dim formID As Integer = 0
Dim title As String = "", messageRO As String = "ReadOnly fields:" + vbCrLf, messageREQ As String = "Required fields:" + vbCrLf
Dim roFlag As Boolean = False, reqFlag As Boolean = False
For i As Integer = 0 To count - 1
formID = gdpicturePDF.GetFormFieldId(i)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
title = gdpicturePDF.GetFormFieldTitle(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
roFlag = gdpicturePDF.GetFormFieldReadOnly(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If roFlag Then messageRO = messageRO + title + "; "
Else
message = message + title + ": GetFormFieldReadOnly - " + gdpicturePDF.GetStat().ToString() + vbCrLf
End If
reqFlag = gdpicturePDF.GetFormFieldRequired(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If reqFlag Then messageREQ = messageREQ + title + "; "
Else
message = message + title + ": GetFormFieldRequired - " + gdpicturePDF.GetStat().ToString() + vbCrLf
End If
Else
message = message + i.ToString() + ": The GetFormFieldTitle() method has failed with the status: " + gdpicturePDF.GetStat().ToString() + vbCrLf
End If
Else
message = message + i.ToString() + ": The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString() + vbCrLf
End If
Next
message = messageRO + vbCrLf + vbCrLf + messageREQ + vbCrLf + vbCrLf + message + vbCrLf + "Done!"
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: GetFormFieldRequired";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetFormFieldsCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
string message = "";
if (count == 0)
message = "This document does not contain any forms.";
else
{
int formID = 0;
string title = "", messageRO = "ReadOnly fields:\n", messageREQ = "Required fields:\n";
bool roFlag = false, reqFlag = false;
for (int i = 0; i < count; i++)
{
formID = gdpicturePDF.GetFormFieldId(i);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
title = gdpicturePDF.GetFormFieldTitle(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
roFlag = gdpicturePDF.GetFormFieldReadOnly(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (roFlag)
messageRO = messageRO + title + "; ";
}
else
message = message + title + ": GetFormFieldReadOnly - " + gdpicturePDF.GetStat().ToString() + "\n";
reqFlag = gdpicturePDF.GetFormFieldRequired(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (reqFlag)
messageREQ = messageREQ + title + "; ";
}
else
message = message + title + ": GetFormFieldRequired - " + gdpicturePDF.GetStat().ToString() + "\n";
}
else
message = message + i.ToString() + ": The GetFormFieldTitle() method has failed with the status: " + gdpicturePDF.GetStat().ToString() + "\n";
}
else
message = message + i.ToString() + ": The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString() + "\n";
}
message = messageRO + "\n\n" + messageREQ + "\n\n" + message + "\nDone!";
}
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();