class HexaPDF:: Type:: AcroForm:: VariableTextField
Parent | HexaPDF::Type::AcroForm::Field |
---|
An AcroForm
variable text field defines how text that it is not known at generation time should be rendered. For example, AcroForm
text fields (normally) don’t have an initial value; the value is entered by the user and needs to be rendered correctly by the PDF reader.
See: PDF2.0 s12.7.4.3
Field Definitions
Name | Type/Allowed Values | Required | Default Value |
---|---|---|---|
FT | Symbol One of: :Btn, :Tx, :Ch, :Sig | false | nil |
Parent | HexaPDF::Type::AcroForm::Field or Hash | false | nil |
Kids | HexaPDF::PDFArray or Array | false | nil |
T | String | false | nil |
TU | String | false | nil |
TM | String | false | nil |
Ff | Integer | false | 0 |
V | HexaPDF::Dictionary or Symbol or String or HexaPDF::Stream or HexaPDF::PDFArray or Hash or Array | false | nil |
DV | HexaPDF::Dictionary or Symbol or String or HexaPDF::Stream or HexaPDF::PDFArray or Hash or Array | false | nil |
AA | HexaPDF::Dictionary or Hash | false | nil |
DA | HexaPDF::DictionaryFields::PDFByteString or String | false | nil |
Q | Integer One of: 0, 1, 2 | false | 0 |
DS | String | false | nil |
RV | String or HexaPDF::Stream or Hash | false | nil |
Constants
- INHERITABLE_FIELDS¶
All inheritable dictionary fields for text fields.
Public Class Methods
Creates an AcroForm
appearance string for the HexaPDF
document
from the given arguments and returns it.
font
-
The name of the font.
font_options
-
Additional font options like :variant used when loading the font. See
HexaPDF::Document::Fonts#add
font_size
-
The font size. If this is set to 0, the font size is calculated using the height/width of the field.
font_color
-
The font color. See
HexaPDF::Content::ColorSpace.device_color_from_specification
for allowed values.
Parses the given appearance string.
If no block is given, the appearance string is searched for font name, font size and font color all of which are returned. Otherwise the block is called with each found content stream operator and has to handle them itself.
Public Instance Methods
Parses the default appearance string and returns an array containing [font_name, font_size, font_color].
The default appearance string is taken from the given widget
of the field, falls back to the field itself and then the default appearance string of the form. If it still not available, a standard default appearance string is set (see set_default_appearance_string
) and used.
The reason why a specific widget of the field can be specified is because the widgets of a field might differ in their visual representation.
Sets the default appearance string using the provided values or the default values which provide a sane default.
See ::create_appearance_string
for information on the arguments.
Sets or returns the text alignment that should be used when displaying text.
With no argument, the current text alignment is returned. When a value is provided, the text alignment is set accordingly.
The alignment value is one of :left, :center or :right.