class HexaPDF:: Type:: AcroForm:: TextField
Parent | VariableTextField |
---|
AcroForm
text fields provide a box or space to fill-in data entered from keyboard. The text may be restricted to a single line or can span multiple lines.
A special type of single-line text field is the comb text field. This type of field divides the existing space into /MaxLen equally spaced positions.
Type
Specific Field
Flags¶ ↑
- :multiline
-
If set, the text field may contain multiple lines.
- :password
-
The field is a password field. This changes the behaviour of the PDF reader application to not echo the input text and to not store it in the PDF file.
- :file_select
-
The text field represents a file selection control where the input text is the path to a file.
- :do_not_spell_check
-
The text should not be spell-checked.
- :do_not_scroll
-
The text field should not scroll (horizontally for single-line fields and vertically for multiline fields) to accomodate more text than fits into the annotation rectangle. This means that no more text can be entered once the field is full.
- :comb
-
The field is divided into /MaxLen equally spaced positions (so /MaxLen needs to be set). This is useful, for example, when entering things like social security numbers which always have the same length.
- :rich_text
-
The field is a rich text field.
See: PDF2.0 s12.7.5.3
Constants
Public Instance Methods
Returns true
if this field is a comb text field.
Returns the concrete text field type, either :single_line_text_field, :multiline_text_field, :password_field, :file_select_field, :comb_text_field or :rich_text_field.
Creates appropriate appearances for all widgets.
For information on how this is done see AppearanceGenerator
.
Note that no new appearances are created if the field value hasn't changed between invocations.
By setting force
to true
the creation of the appearances can be forced.
Returns the default field value.
See: field_value
Sets the default field value.
See: field_value=
Returns the field value, i.e. the text contents of the field, or nil
if no value is set.
Note that modifying the returned value *might not* modify the text contents in case it is stored as stream! So always use field_value=
to set the field value.
Sets the field value, i.e. the text contents of the field, to the given string.
Note that for single line text fields, all whitespace characters are changed to simple spaces.
Returns true
if this field is a file select field.
Initializes the text field to be a comb text field.
This method should only be called directly after creating a new text field because it doesn't completely reset the object.
Initializes the text field to be a file select field.
This method should only be called directly after creating a new text field because it doesn't completely reset the object.
Initializes the text field to be a multiline text field.
This method should only be called directly after creating a new text field because it doesn't completely reset the object.
Initializes the text field to be a password field.
This method should only be called directly after creating a new text field because it doesn't completely reset the object.
Returns true
if this field is a multiline text field.
Returns true
if this field is a password field.
Updates the widgets so that they reflect the current field value.