SetaPDF_FormFiller_Field_Text A text field
File: /SetaPDF v2/FormFiller/Field/Text.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- _checkPermission()
- _getAppearanceReference()
- _getBorderWidthAndStyle()
- _getFontRelation()
- _postDelete()
- _preDelete()
- _preFlatten()
- _purgeValue()
- _recreateAppearance()
- cleanUp()
- delete()
- flatten()
- getAdditionalActions()
- getAnnotation()
- getAppearanceCanvas()
- getAppearanceFont()
- getAppearanceFontSize()
- getAppearanceTextColor()
- getAppearanceTextColorSpace()
- getAppearanceValue()
- getDefaultAppearanceData()
- getDefaultValue()
- getFieldDictionary()
- getFieldFlags()
- getFieldObject()
- getFields()
- getLineHeightFactor()
- getMaxLength()
- getName()
- getNoExport()
- getNormalAppearanceObject()
- getObserveTextOverflow()
- getOriginalQualifiedName()
- getPage()
- getPageNumber()
- getQualifiedName()
- getTextOverflow()
- getTooltip()
- getValue()
- getVisibleValue()
- isCombField()
- isDoNotScrollSet()
- isDoNotSpellCheckSet()
- isFieldFlagSet()
- isMultiline()
- isPasswordField()
- isReadOnly()
- isRequired()
- recreateAppearance()
- setAppearanceFont()
- setAppearanceFontSize()
- setAppearanceTextColor()
- setAppearanceTextColorSpace()
- setAppearanceValueCallback()
- setCombField()
- setDefaultValue()
- setDoNotScroll()
- setDoNotSpellCheck()
- setFieldFlags()
- setLineHeightFactor()
- setMaxLength()
- setMultiline()
- setNoExport()
- setObserveTextOverflow()
- setPasswordField()
- setReadOnly()
- setRequired()
- setTextTranslate()
- setTooltip()
- setValue()
- unsetFieldFlags()
Properties
- $_additionalActions
- $_annotation
- $_appearanceCanvas
- $_appearanceCreated
- $_appearanceValueCallback
- $_defaultAppearanceData
- $_fieldDictionary
- $_fieldObject
- $_fields
- $_font
- $_fontSize
- $_lineHeightFactor
- $_observeTextOverflow
- $_originalQualifiedName
- $_page
- $_qualifiedName
- $_textColor
- $_textColorSpace
- $_textOverflow
- $_textTranslateData
Constants
OVERFLOWS_HORIZONTALLY
Constant saying that text overflows horizontally
OVERFLOWS_NONE
Constant saying that no text overflows the visible area
OVERFLOWS_VERTICALLY
Constant saying that text overflows vertically
Properties
$_annotation
The annotation object of this form field
$_fontSize
The font size, which should be used to create the appearance
$_lineHeightFactor
The factor to calculate the line height based on the font size
$_originalQualifiedName
The name without the suffix
$_qualifiedName
The name including a suffix if needed ("Text#1")
$_textColorSpace
An individual color space object which should be used for setting the non-stroking color space
$_textOverflow
Flag indicating that the text overflows the visible area of the field.
$_textTranslateData
Data to be used for translation of the initial x/y coordinates of the field appearance.
Methods
__construct()
The constructor.
Parameters
- $fields : SetaPDF_FormFiller_Fields
The fields instance
- $qualifiedName : string
The qualified name of the field
- $fieldObject : SetaPDF_Core_Type_IndirectReference|SetaPDF_Core_Type_IndirectObject
- $originalQualifiedName : string
The original qualified name of the field
_checkPermission()
Checks for form-filling permissions.
Parameters
- $permission : integer
Exceptions
_getAppearanceReference()
Get the reference to the normal appearance stream object.
_getFontRelation()
Get the font relation and copy the resources to the Resources entry if needed.
Parameters
- $nDictionary : SetaPDF_Core_Type_Dictionary
- $fontName : string
Exceptions
Throws SetaPDF_FormFiller_Exception
_postDelete()
A method called after deleting a field.
This method forwards the deletion info to the fields instance.
_preDelete()
A method called before deleting a field.
This method forwards the deletion info to the fields instance.
_preFlatten()
A method called before flattening a field.
This method forwards the flatten info to the fields instance.
_purgeValue()
Purges the value accoring to field properties like "multiline" or "max-length".
Parameters
- $value : string
Value in UTF-16BE encoding
_recreateAppearance()
Recreate or creates the background appearance of the form field.
Parameters
- $circle : null|SetaPDF_Core_Canvas
- $canvas
flatten()
Flatten the field to the pages content stream.
Parameters
- $recreateAppearanceIfNeedAppearancesIsSet : boolean
Defines whether the field appearance is re-created if the NeedAppearances flag is set.
Exceptions
Throws SetaPDF_Core_Type_Exception
Throws SetaPDF_Core_Type_IndirectReference_Exception
See
getAdditionalActions()
Gets the additional actions object instance for this field.
getAnnotation()
Get the widget annotation object from this field.
getAppearanceFont()
Get the appearance font object.
getAppearanceTextColor()
Get the individual appearance text color.
getAppearanceTextColorSpace()
Get the individual color space object which should be used for setting the non-stroking color space.
getDefaultAppearanceData()
Get the default appearance data of the DA value.
Exceptions
getDefaultValue()
Returns the default value of the field.
This value is used if the form is reset.
Parameters
- $encoding : string
See
getFieldDictionary()
Get the field dictionary.
getFieldObject()
Get the indirect object of the form field.
getLineHeightFactor()
Get the line height factor
The line height is calculated by this factor in relation to the font size:
$lineHeight = $fontSize * $lineHeightFactor
By default this value is calculated by the font bounding box values "ury - lly / 1000".
See
getNormalAppearanceObject()
Get or create the normal appearance object (the object referenced in the N entry).
Parameters
- $createNew : boolean
Pass true to force a recreation
getTextOverflow()
Check if the visible text overflows the visible area.
Return Values
If the annotation was not rendered null is returned. Otherwise 1 if the text overflows vertically or 2 if the text overflows horizontally. 3 for both.
getTooltip()
Get the tooltip value.
Parameters
- $encoding : string
setAppearanceFont()
Set the appearance font object.
Parameters
- $font : SetaPDF_Core_Font_FontInterface
- $size : float
setAppearanceTextColor()
Set an individual appearance text color.
Parameters
- $textColor : SetaPDF_Core_DataStructure_Color
setAppearanceTextColorSpace()
Set the individual color space object which should be used for setting the non-stroking color space.
Parameters
- $colorSpace : SetaPDF_Core_ColorSpace|null
setAppearanceValueCallback()
Set the appearance value callback (to e.g. format a number).
The callback will be called with 2 arguments:
- A reference to the field instance
- The requested encoding
It needs to return a value in the specified encoding (internal calls need UTF-16BE throughout).
Parameters
- $callback : callback
setCombField()
Set the comb field flag.
Changing this flag will re-create the field appearance.
Parameters
- $comb : boolean
Exceptions
setDefaultValue()
Set the default value of the field.
Parameters
- $value : null|string
- $encoding : string
setDoNotSpellCheck()
Set the "do not spell check" flag.
Parameters
- $doNotSpellCheck : boolean
Exceptions
setFieldFlags()
Sets a field flag.
Parameters
- $flags : integer
- $add : boolean|null
Add = true, remove = false, set = null
setLineHeightFactor()
Set the line height factor
The line height is calculated by this factor in relation to the font size:
$lineHeight = $fontSize * $lineHeightFactor
By default this value is calculated by the font bounding box values "ury - lly / 1000".
Parameters
- $lineHeightFactor : null|float
See
setMaxLength()
Set the max length property.
Changing this flag will reset the value to a value that fits into the given maximal length.
Parameters
- $maxLength : integer
setMultiline()
Set the multiline flag.
Changing this flag will re-create the field appearance.
Parameters
- $multiline : bool|true
Exceptions
setObserveTextOverflow()
Set whether observing text overflow is enabled or not.
Parameters
- $observeTextOverflow : boolean
setPasswordField()
Set the password field flag.
Changing this flag will re-create the field appearance.
Parameters
- $password : boolean
Exceptions
setTextTranslate()
Set translate data for the text appearance.
Parameters
- $x : integer
The value by which the text should be translated on the abscissa.
- $y : integer
The value by which the text should be translated on the ordinate.
setTooltip()
Set the tooltip value.
Parameters
- $value : string|false
- $encoding : string
setValue()
Set the field value.
If the fields multiline flag is set (see isMultiline()) the method accepts a string of several lines.
All common line delimiters are possible: \r\n, \n or \r
Internally they get normalized. So if you need to compare a value of the getValue() method keep this in mind.
Parameters
- $value : string
The text field value
- $encoding : string
The input encoding