SetaPDF_FormFiller_Field_Text A text field

File: /SetaPDF/FormFiller/Field/Text.php

Class hierarchy

Implements

Summary

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

$_appearanceCanvas

The canvas object of the appearance

$_fieldDictionary

$_fieldObject

$_fields

A reference to the fields instance

$_font

The font object, which should be used to create the appearance

$_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

$_observeTextOverflow

Defines whether observing text overflow is enabled or not

$_originalQualifiedName

The name without the suffix

$_page

The page instance on which the form field is placed

$_qualifiedName

The name including a suffix if needed ("Text#1")

$_textColor

An individual color object which should be used for drawing the text appearance

$_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()

public SetaPDF_FormFiller_Field_AbstractField::__construct ( SetaPDF_FormFiller_Fields $fields, string $qualifiedName, SetaPDF_Core_Type_IndirectReference|SetaPDF_Core_Type_IndirectObject $fieldObject [, string $originalQualifiedName = null ] )

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

The indirect object or reference holding the field dictionary

$originalQualifiedName : string

The original qualified name of the field

_checkPermission()

protected void SetaPDF_FormFiller_Field_AbstractField::_checkPermission ( [ integer $permission = \SetaPDF_Core_SecHandler::PERM_FILL_FORM ] )

Checks for form-filling permissions.

Parameters
$permission : integer
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

_getAppearanceReference()

protected SetaPDF_Core_Type_IndirectObject SetaPDF_FormFiller_Field_AbstractField::_getAppearanceReference ( void )

Get the reference to the normal appearance stream object.

_getFontRelation()

protected SetaPDF_Core_Type_Dictionary_Entry SetaPDF_FormFiller_Field_AbstractField::_getFontRelation ( SetaPDF_Core_Type_Dictionary $nDictionary, string &$fontName )

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()

protected void SetaPDF_FormFiller_Field_AbstractField::_postDelete ( void )

A method called after deleting a field.

This method forwards the deletion info to the fields instance.

_preDelete()

protected void SetaPDF_FormFiller_Field_AbstractField::_preDelete ( void )

A method called before deleting a field.

This method forwards the deletion info to the fields instance.

_preFlatten()

protected void SetaPDF_FormFiller_Field_AbstractField::_preFlatten ( void )

A method called before flattening a field.

This method forwards the flatten info to the fields instance.

_purgeValue()

protected string SetaPDF_FormFiller_Field_Text::_purgeValue ( string $value )

Purges the value accoring to field properties like "multiline" or "max-length".

Parameters
$value : string

Value in UTF-16BE encoding

_recreateAppearance()

protected SetaPDF_Core_Canvas SetaPDF_FormFiller_Field_AbstractField::_recreateAppearance ( void )

Recreate or creates the background appearance of the form field.

cleanUp()

public void SetaPDF_FormFiller_Field_Text::cleanUp ( void )

Release cycled references and release memory.

delete()

public void SetaPDF_FormFiller_Field_AbstractField::delete ( void )

Delete the field.

flatten()

public void SetaPDF_FormFiller_Field_AbstractField::flatten ( void )

Flatten the field to the pages content stream.

See

getAdditionalActions()

public SetaPDF_FormFiller_Field_AdditionalActions SetaPDF_FormFiller_Field_Text::getAdditionalActions ( void )

Gets the additional actions object instance for this field.

getAnnotation()

public SetaPDF_Core_Document_Page_Annotation_Widget SetaPDF_FormFiller_Field_AbstractField::getAnnotation ( void )

Get the widget annotation object from this field.

getAppearanceCanvas()

public SetaPDF_Core_Canvas SetaPDF_FormFiller_Field_AbstractField::getAppearanceCanvas ( void )

Get the appearance canvas of the "normal" appearance object.

getAppearanceFont()

public null|SetaPDF_Core_Font SetaPDF_FormFiller_Field_AbstractField::getAppearanceFont ( void )

Get the appearance font object.

getAppearanceFontSize()

public float|null SetaPDF_FormFiller_Field_AbstractField::getAppearanceFontSize ( void )

Get the appearance font size.

Exceptions

Throws SetaPDF_FormFiller_Field_Exception

getAppearanceTextColor()

public null|SetaPDF_Core_DataStructure_Color SetaPDF_FormFiller_Field_AbstractField::getAppearanceTextColor ( void )

Get the individual appearance text color.

getDefaultAppearanceData()

public SetaPDF_FormFiller_Field_DefaultAppearanceData SetaPDF_FormFiller_Field_AbstractField::getDefaultAppearanceData ( void )

Get the default appearance data of the DA value.

Exceptions

Throws SetaPDF_FormFiller_Field_Exception

getDefaultValue()

public null|string SetaPDF_FormFiller_Field_Text::getDefaultValue ( [ string $encoding = 'UTF-8' ] )

Returns the default value of the field.

This value is used if the form is reset.

Parameters
$encoding : string
 
See

getFieldDictionary()

public SetaPDF_Core_Type_AbstractType|SetaPDF_Core_Type_Dictionary SetaPDF_FormFiller_Field_AbstractField::getFieldDictionary ( void )

Get the field dictionary.

getFieldFlags()

public integer SetaPDF_FormFiller_Field_AbstractField::getFieldFlags ( void )

Returns the current field flags.

getFieldObject()

public SetaPDF_Core_Type_IndirectObject SetaPDF_FormFiller_Field_AbstractField::getFieldObject ( void )

Get the indirect object of the form field.

getFields()

public SetaPDF_FormFiller_Fields SetaPDF_FormFiller_Field_AbstractField::getFields ( void )

Get the fields instance.

getLineHeightFactor()

public float SetaPDF_FormFiller_Field_AbstractField::getLineHeightFactor ( void )

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

getMaxLength()

public boolean|integer SetaPDF_FormFiller_Field_Text::getMaxLength ( void )

Get the max length property if available.

getName()

public string SetaPDF_FormFiller_Field_AbstractField::getName ( void )

Alias for getQualifiedName().

See

getNoExport()

public boolean SetaPDF_FormFiller_Field_AbstractField::getNoExport ( void )

Checks if the no-export flag is set.

getNormalAppearanceObject()

public SetaPDF_Core_Type_IndirectObject SetaPDF_FormFiller_Field_AbstractField::getNormalAppearanceObject ( [ boolean $createNew = false ] )

Get or create the normal appearance object (the object referenced in the N entry).

Parameters
$createNew : boolean

Pass true to force a recreation

getObserveTextOverflow()

public boolean SetaPDF_FormFiller_Field_Text::getObserveTextOverflow ( void )

Get whether observing text overflow is enabled or not.

getOriginalQualifiedName()

public string SetaPDF_FormFiller_Field_AbstractField::getOriginalQualifiedName ( void )

Get the original qualified name (without suffix).

getPage()

public SetaPDF_Core_Document_Page SetaPDF_FormFiller_Field_AbstractField::getPage ( void )

Gets the page object on which the form field is placed.

Exceptions

Throws SetaPDF_FormFiller_Field_Exception

getPageNumber()

public integer SetaPDF_FormFiller_Field_AbstractField::getPageNumber ( void )

Get the page number on which the field appears.

getQualifiedName()

public string SetaPDF_FormFiller_Field_AbstractField::getQualifiedName ( void )

Returns the qualified name.

getTextOverflow()

public null|integer SetaPDF_FormFiller_Field_Text::getTextOverflow ( void )

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()

public bool|string SetaPDF_FormFiller_Field_AbstractField::getTooltip ( [ string $encoding = 'UTF-8' ] )

Get the tooltip value.

Parameters
$encoding : string
 

getValue()

public string SetaPDF_FormFiller_Field_Text::getValue ( [ string $encoding = 'UTF-8' ] )

Get the field value.

Parameters
$encoding : string

The output encoding

See

isCombField()

public boolean SetaPDF_FormFiller_Field_Text::isCombField ( void )

Check if the comb field flag is set.

isDoNotScrollSet()

public boolean SetaPDF_FormFiller_Field_Text::isDoNotScrollSet ( void )

Check if the "do not scroll" flag is set.

isDoNotSpellCheckSet()

public boolean SetaPDF_FormFiller_Field_Text::isDoNotSpellCheckSet ( void )

Check if the "do not spell check" flag is set.

isFieldFlagSet()

public boolean SetaPDF_FormFiller_Field_AbstractField::isFieldFlagSet ( integer $flag )

Checks if a specific field flag is set.

Parameters
$flag : integer
 

isMultiline()

public boolean SetaPDF_FormFiller_Field_Text::isMultiline ( void )

Check if the multiline flag is set.

isPasswordField()

public boolean SetaPDF_FormFiller_Field_Text::isPasswordField ( void )

Check if the password field flag is set.

isReadOnly()

public boolean SetaPDF_FormFiller_Field_AbstractField::isReadOnly ( void )

Checks if the field is set to read-only.

isRequired()

public boolean SetaPDF_FormFiller_Field_AbstractField::isRequired ( void )

Checks if the field is set to be required.

recreateAppearance()

public void SetaPDF_FormFiller_Field_Text::recreateAppearance ( void )

Recreate or creates the Appearance of the form field.

setAppearanceFont()

public void SetaPDF_FormFiller_Field_AbstractField::setAppearanceFont ( SetaPDF_Core_Font $font [, float $size = null ] )

Set the appearance font object.

Parameters
$font : SetaPDF_Core_Font
 
$size : float
 

setAppearanceFontSize()

public void SetaPDF_FormFiller_Field_AbstractField::setAppearanceFontSize ( float|null $fontSize )

Set an individual font size.

Parameters
$fontSize : float|null
 

setAppearanceTextColor()

public void SetaPDF_FormFiller_Field_AbstractField::setAppearanceTextColor ( [ SetaPDF_Core_DataStructure_Color $textColor = null ] )

Set an individual appearance text color.

Parameters
$textColor : SetaPDF_Core_DataStructure_Color
 

setCombField()

public void SetaPDF_FormFiller_Field_Text::setCombField ( [ boolean $comb = true ] )

Set the comb field flag.

Changing this flag will re-create the field appearance.

Parameters
$comb : boolean
 
Exceptions

Throws SetaPDF_FormFiller_Field_Exception

setDefaultValue()

public void SetaPDF_FormFiller_Field_Text::setDefaultValue ( null|string $value [, string $encoding = 'UTF-8' ] )

Set the default value of the field.

Parameters
$value : null|string
 
$encoding : string
 

setDoNotScroll()

public void SetaPDF_FormFiller_Field_Text::setDoNotScroll ( [ boolean $doNotScroll = true ] )

Set the "do not scroll" flag.

Parameters
$doNotScroll : boolean
 

setDoNotSpellCheck()

public void SetaPDF_FormFiller_Field_Text::setDoNotSpellCheck ( [ boolean $doNotSpellCheck = true ] )

Set the "do not spell check" flag.

Parameters
$doNotSpellCheck : boolean
 
Exceptions

Throws SetaPDF_FormFiller_Field_Exception

setFieldFlags()

public void SetaPDF_FormFiller_Field_AbstractField::setFieldFlags ( integer $flags [, boolean|null $add = true ] )

Sets a field flag.

Parameters
$flags : integer
 
$add : boolean|null

Add = true, remove = false, set = null

setLineHeightFactor()

public void SetaPDF_FormFiller_Field_AbstractField::setLineHeightFactor ( null|float $lineHeightFactor )

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()

public void SetaPDF_FormFiller_Field_Text::setMaxLength ( integer $maxLength )

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()

public void SetaPDF_FormFiller_Field_Text::setMultiline ( [ bool|true $multiline = true ] )

Set the multiline flag.

Changing this flag will re-create the field appearance.

Parameters
$multiline : bool|true
 
Exceptions

Throws SetaPDF_FormFiller_Field_Exception

setNoExport()

public void SetaPDF_FormFiller_Field_AbstractField::setNoExport ( [ boolean $noExport = true ] )

Set the no-export flag.

Parameters
$noExport : boolean
 

setObserveTextOverflow()

public void SetaPDF_FormFiller_Field_Text::setObserveTextOverflow ( boolean $observeTextOverflow )

Set whether observing text overflow is enabled or not.

Parameters
$observeTextOverflow : boolean
 

setPasswordField()

public void SetaPDF_FormFiller_Field_Text::setPasswordField ( [ boolean $password = true ] )

Set the password field flag.

Changing this flag will re-create the field appearance.

Parameters
$password : boolean
 
Exceptions

Throws SetaPDF_FormFiller_Field_Exception

setReadOnly()

public void SetaPDF_FormFiller_Field_AbstractField::setReadOnly ( [ boolean $readOnly = true ] )

Sets the read-only flag.

Parameters
$readOnly : boolean
 

setRequired()

public void SetaPDF_FormFiller_Field_AbstractField::setRequired ( [ boolean $required = true ] )

Sets the required flag.

Parameters
$required : boolean
 

setTextTranslate()

public void SetaPDF_FormFiller_Field_Text::setTextTranslate ( [ integer $x = 0 [, integer $y = 0 ]] )

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()

public void SetaPDF_FormFiller_Field_AbstractField::setTooltip ( string|false $value [, string $encoding = 'UTF-8' ] )

Set the tooltip value.

Parameters
$value : string|false
 
$encoding : string
 

setValue()

public void SetaPDF_FormFiller_Field_Text::setValue ( string $value [, string $encoding = 'UTF-8' ] )

Set the field value.

If the fields multiline flag is set (see isMultiline()) the method accepts a string of several lines.

All common line delemitters 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

unsetFieldFlags()

public void SetaPDF_FormFiller_Field_AbstractField::unsetFieldFlags ( integer $flags )

Removes a field flag.

Parameters
$flags : integer