SetaPDF_FormFiller_Field_List A list field

File: /SetaPDF v2/FormFiller/Field/List.php

Class hierarchy

Implements

Summary

Properties

$_annotation

$_appearanceCanvas

The canvas object of the appearance

$_appearanceCreated

$_exportValues

The plain export values in the original encoding

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

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

$_textColorSpace

An individual color space object which should be used for setting the non-stroking color space


Methods

__construct()

public SetaPDF_FormFiller_Field_AbstractField::__construct (
SetaPDF_FormFiller_Fields $fields, string $qualifiedName, 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_IndirectObject

The indirect object holding the field dictionary (terminal field object)

$originalQualifiedName : string

The original qualified name of the field

Exceptions

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

_checkPermission()

Checks for form-filling permissions.

Parameters
$permission : integer
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

_getAppearanceReference()

Get the reference to the normal appearance stream object.

_getBorderWidthAndStyle()

Resolve the border width and style

Exceptions

Throws SetaPDF_Core_Type_Exception

_getCurrentOptionIndices()

Gets the indices of the currently selected options.

Exceptions

Throws SetaPDF_Core_Type_Exception

See

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

Throws SetaPDF_Core_Type_Exception

_getTDictionary()

Get the dictionary that holds the last "T" entry.

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

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

_preFlatten()

A method called before flattening a field.

This method forwards the flatten info to the fields instance.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

_recreateAppearance()

protected SetaPDF_FormFiller_Field_AbstractField::_recreateAppearance (
[ bool $circle = false [, null|SetaPDF_Core_Canvas $canvas = null ]]
): SetaPDF_Core_Canvas

Recreate or creates the background appearance of the form field.

Parameters
$circle : bool
 
$canvas : null|SetaPDF_Core_Canvas
 
Exceptions

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception_NotImplemented

cleanUp()

Release cycled references and release memory.

flatten()

public SetaPDF_FormFiller_Field_AbstractField::flatten (
[ boolean $recreateAppearanceIfNeedAppearancesIsSet = false ]
): void

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_Document_ObjectNotFoundException

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_Parser_Pdf_InvalidTokenException

Throws SetaPDF_Core_Reader_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

See

getAdditionalActions()

Gets the additional actions object instance for this field.

getAnnotation()

Get the widget annotation object from this field.

Exceptions

Throws SetaPDF_Core_Type_Exception

getAppearanceCanvas()

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

Exceptions

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception_NotImplemented

getAppearanceTextColorSpace()

Get the individual color space object which should be used for setting the non-stroking color space.

getDefaultValue()

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

Returns the default value(s) of the field.

This value is used if the form is reset

Parameters
$encoding : string

The output encoding

Exceptions

Throws SetaPDF_Core_Type_Exception

See

getFieldDictionary()

getFieldFlags()

Returns the current field flags.

getFieldObject()

Get the indirect object of the form field.

getFields()

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".

Exceptions

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_Font_Exception

Throws SetaPDF_Core_Parser_Pdf_InvalidTokenException

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_FormFiller_Exception

Throws SetaPDF_FormFiller_Field_Exception

See

getName()

getNoExport()

Checks if the no-export flag is set.

getNormalAppearanceObject()

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

Parameters
$createNew : boolean

Pass true to force a recreation

Exceptions

Throws SetaPDF_Core_Type_Exception

getOptions()

public SetaPDF_FormFiller_Field_Choice_AbstractChoice::getOptions (
[ string $encoding = 'UTF-8' ]
): array

Get the options and the export values.

Parameters
$encoding : string

The output encoding

Return Values

An array of arrays with following keys: visibleValue and exportValue

Exceptions

Throws SetaPDF_Core_Type_Exception

getOriginalQualifiedName()

Get the original qualified name (without suffix).

getPage()

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

Exceptions

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_FormFiller_Field_Exception

getQualifiedName()

Returns the qualified name.

getTooltip()

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

Get the tooltip value.

Parameters
$encoding : string
 

getValue()

public SetaPDF_FormFiller_Field_List::getValue (
[ string $encoding = 'UTF-8' ]
): string|array|null

Get the current value(s).

If the field is a multi select field, this method will return an array. If not it will return a string

Parameters
$encoding : string

The output encoding

Return Values

If no option is selected and the multi select flag is not set the method will return null. If the flag is set an empty array. Otherwise, the active value or the active values in an array.

Exceptions

Throws SetaPDF_Core_Type_Exception

getVisibleValue()

public SetaPDF_FormFiller_Field_List::getVisibleValue (
[ string $encoding = 'UTF-8' ]
): string|array

Get the current visible value(s).

If the field is a multi select field, this method will return an array. If not it will return a string

Parameters
$encoding : string

The output encoding

Exceptions

Throws SetaPDF_Core_Type_Exception

isFieldFlagSet()

public SetaPDF_FormFiller_Field_AbstractField::isFieldFlagSet (
integer $flag
): boolean

Checks if a specific field flag is set.

Parameters
$flag : integer
 

isMultiSelect()

Checks if the field is a multi select field.

isReadOnly()

Checks if the field is set to read-only.

isRequired()

Checks if the field is set to be required.

setAppearanceFont()

Set the appearance font object.

Parameters
$font : SetaPDF_Core_Font_FontInterface
 
$size : float
 

setAppearanceFontSize()

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

Set an individual font size.

Parameters
$fontSize : float|null
 

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
 

setDefaultValue()

public SetaPDF_FormFiller_Field_List::setDefaultValue (
mixed $value [, string $encoding = 'UTF-8' ]
): void

Set the default value.

Parameters
$value : mixed
 
$encoding : string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_FormFiller_Exception

setFieldFlags()

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

Sets a field flag.

Parameters
$flags : integer
 
$add : boolean|null

Add = true, remove = false, set = null

setLineHeightFactor()

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

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

setMultiSelect()

setNoExport()

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

Set the no-export flag.

Parameters
$noExport : boolean
 

setReadOnly()

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

Sets the read-only flag.

Parameters
$readOnly : boolean
 
Exceptions

Throws DOMException

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_FormFiller_Exception

setRequired()

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

Sets the required flag.

Parameters
$required : boolean
 

setTooltip()

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

Set the tooltip value.

Parameters
$value : string|false
 
$encoding : string
 

setValue()

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

Set the fields value / Selects the options.

Parameters
$value : mixed

The value could be an export value of an option or the numeric index of an option, received by getOptions(). Also an array of this values could be passed if the field is marked as a MultiSelect field

$encoding : string

The input encoding

Exceptions

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_Font_Exception

Throws SetaPDF_Core_Parser_Pdf_InvalidTokenException

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_FormFiller_Exception

Throws SetaPDF_FormFiller_Field_Exception

unsetFieldFlags()

Removes a field flag.

Parameters
$flags : integer