Class PasswordField
Represents a password input field in the SfPdfViewer2 component.
Inherited Members
Namespace: Syncfusion.Blazor.SfPdfViewer
Assembly: Syncfusion.Blazor.SfPdfViewer.dll
Syntax
public class PasswordField : FormFieldInfo
Remarks
Initializes a new instance of the PasswordField class with the default field type set to "Password."
This field allows users to input text securely in interactive PDF forms, where the input is masked for privacy.
Examples
PasswordField passwordField = new PasswordField();
passwordField.Name = "UserPassword";
passwordField.Value = "Enter your password";
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { passwordField });
Constructors
PasswordField()
Initializes a new instance of the PasswordField class in the SfPdfViewer2 component.
Declaration
public PasswordField()
Remarks
This constructor creates a password field with the default field type set to "Password." Password input fields mask user-entered text for security purposes.
Examples
PasswordField passwordField = new PasswordField();
passwordField.Name = "UserPassword";
passwordField.Value = "Enter your password";
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { passwordField });
Properties
MaxLength
Gets or sets the maximum number of characters allowed in the PasswordField of the SfPdfViewer2 component.
Declaration
public int MaxLength { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | A System.Int32 representing the maximum number of characters allowed in the password field. |
Remarks
Specifies the upper limit for user input in the PasswordField. When this property is set, the field restricts user input to the specified character limit. Setting the value to 0 or a negative number means no limit is applied. This property is useful for ensuring that password input meets security or formatting requirements.
Examples
PasswordField passwordField = new PasswordField();
passwordField.MaxLength = 16; // Restricts password input to 16 characters.
Value
Gets or sets the password input of the PasswordField in the SfPdfViewer2 component.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the password input of the PasswordField. |
Remarks
Represents the user-entered or pre-filled password in the PasswordField.
Changing this property updates the stored password value in the corresponding PDF form field.
The input is masked in the PDF viewer for security purposes.
Examples
PasswordField passwordField = new PasswordField();
passwordField.Value = "SecurePass123"; // Sets the password field value.