A unique form field identifier specifying a required form field object. You can obtain this identifier using these methods: AddTextFormField(Single,Single,Single,Single,String,String,Boolean,String,Single,Byte,Byte,Byte), GetFormFieldId or GetFormFieldChildID.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetFormFieldPassword Method

GetFormFieldPassword Method (GdPicturePDF)

In This Topic
Returns, if the Password flag of a required form field, here a text field, is set. The text field is specified by its unique form field's identifier and it is related to the currently loaded PDF document. As stated, this flag is only specific to text fields, so this method is explicitly applicable to text form field objects.

If this flag is set, then the text field is intended for entering a secure password that should not be echoed visibly to the screen. Instead, the characters typed from the keyboard should be displayed in some unreadable form, usually asterisks.

Syntax
'Declaration

 

Public Function GetFormFieldPassword( _

   ByVal FieldId As Integer _

) As Boolean
public bool GetFormFieldPassword( 

   int FieldId

)
public function GetFormFieldPassword( 

    FieldId: Integer

): Boolean; 
public function GetFormFieldPassword( 

   FieldId : int

) : boolean;
public: bool GetFormFieldPassword( 

   int FieldId

) 
public:

bool GetFormFieldPassword( 

   int FieldId

) 

Parameters

FieldId
A unique form field identifier specifying a required form field object. You can obtain this identifier using these methods: AddTextFormField(Single,Single,Single,Single,String,String,Boolean,String,Single,Byte,Byte,Byte), GetFormFieldId or GetFormFieldChildID.

Return Value

true if the Password flag of the specified text field is set, otherwise false. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Just to remind you that this method is only meaningful for text fields, otherwise it will fail.

Example
How to determine the text fields in the current document, which have the Password flag set.
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();
See Also