Dim caption As String = "Example: GetFormFieldPassword"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF
If (gdpicturePDF.LoadFromFile("forms.pdf", True) = GdPictureStatus.OK) Then
Dim count As Integer = gdpicturePDF.GetFormFieldsCount
If (gdpicturePDF.GetStat = GdPictureStatus.OK) Then
If (count = 0) Then
MessageBox.Show("This file doesn't include forms.", caption)
End If
Dim formID As Integer = 0
Dim title As String = ""
Dim message As String = "Password text form fields:" + vbCrLf
Dim type As PdfFormFieldType = PdfFormFieldType.PdfFormFieldTypeUnknown
Dim isPass As Boolean = False
For i As Integer = 0 To count - 1
formID = gdpicturePDF.GetFormFieldId(i)
If (gdpicturePDF.GetStat <> GdPictureStatus.OK) Then Exit For
type = gdpicturePDF.GetFormFieldType(formID)
If (gdpicturePDF.GetStat <> GdPictureStatus.OK) Then Exit For
If (type = PdfFormFieldType.PdfFormFieldTypeText) Then
title = gdpicturePDF.GetFormFieldTitle(formID)
If (gdpicturePDF.GetStat <> GdPictureStatus.OK) Then Exit For
isPass = gdpicturePDF.GetFormFieldPassword(formID)
If (gdpicturePDF.GetStat <> GdPictureStatus.OK) Then Exit For
If isPass Then message = message + title + "; "
End If
Next
If (gdpicturePDF.GetStat = GdPictureStatus.OK) Then
MessageBox.Show(message, caption)
Else
MessageBox.Show("Something goes wrong. Status: " + gdpicturePDF.GetStat.ToString, caption)
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: GetFormFieldPassword";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", true) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetFormFieldsCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (count == 0)
MessageBox.Show("This file doesn't include forms.", caption);
{
int formID = 0;
string message = "Password text form fields:\n", title = "";
PdfFormFieldType type = PdfFormFieldType.PdfFormFieldTypeUnknown;
bool isPass = false;
for (int i = 0; i < count; i++)
{
formID = gdpicturePDF.GetFormFieldId(i);
if (gdpicturePDF.GetStat() != GdPictureStatus.OK) break;
type = gdpicturePDF.GetFormFieldType(formID);
if (gdpicturePDF.GetStat() != GdPictureStatus.OK) break;
if (type == PdfFormFieldType.PdfFormFieldTypeText)
{
title = gdpicturePDF.GetFormFieldTitle(formID);
if (gdpicturePDF.GetStat() != GdPictureStatus.OK) break;
isPass = gdpicturePDF.GetFormFieldPassword(formID);
if (gdpicturePDF.GetStat() != GdPictureStatus.OK) break;
if (isPass)
message = message + title + "; ";
}
}
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
MessageBox.Show(message, caption);
else
MessageBox.Show("Something goes wrong. Status: " + gdpicturePDF.GetStat().ToString(), 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();