SetaPDF_FormFiller_Xfa Class offering access to XFA data of a PDF form.

File: /SetaPDF v2/FormFiller/Xfa.php

Class hierarchy

Summary

Properties

$_bridge

$_data

The data node.

$_dataNodeUpdated

Flag indicating if the data has to be set back to the data stream on save.

$_domDocument

The document instance of the full XDP packet.

$_formFiller

The form filler instance

$_setValueIsActive

Flag identicating that a setValue() process is working.

$_template

The template node.

$_templateNodeUpdated

Flag indicating that the template node was changed.


Methods

__construct()

The constructor.

Parameters
$formFiller : SetaPDF_FormFiller

The form filler instance

_evaluateValue()

private SetaPDF_FormFiller_Xfa::_evaluateValue (
$value, DOMElement $fieldNode
): DOMNode|string

Evaluates a native value to a data value.

Parameters
$value
 
$fieldNode : DOMElement
 

_findPacketStream()

private SetaPDF_FormFiller_Xfa::_findPacketStream (
SetaPDF_Core_Type_Array $array, string $name [, boolean $create = false ]
): bool|SetaPDF_Core_Type_Stream

Finds a packets stream by its name.

Parameters
$array : SetaPDF_Core_Type_Array
 
$name : string
 
$create : boolean
 

_getBridge()

Get the XFA bridge helper object.

Exceptions

Throws SetaPDF_FormFiller_Exception

cleanUp()

public SetaPDF_FormFiller_Xfa::cleanUp (
void
): void

Releases memory and resources.

deleteField()

public SetaPDF_FormFiller_Xfa::deleteField (
string $fieldName [, bool $reset = true ]
): bool

Delete a field in the template structure.

This method is called internally by the delete() method of an AcroForm field representation. This will also be the case if a field is flattened.

Parameters
$fieldName : string
 
$reset : bool
 
See

getData()

public SetaPDF_FormFiller_Xfa::getData (
[ bool $create = false ]
): bool|DOMElement|DOMNode

Get the data node.

Parameters
$create : bool
 

getDomDocument()

Get the DOMDocument instance of the XFA structure.

Exceptions

Throws SetaPDF_FormFiller_Exception

getFormFiller()

Get the form filler instance.

getObject()

Get the XFA pdf object.

getTemplate()

Gets the template node from the XFA structure.

Exceptions

Throws SetaPDF_FormFiller_Exception

getXml()

public SetaPDF_FormFiller_Xfa::getXml (
void
): bool|string

Get the raw XFA (XML/XMP) data from the PDF document.

getXmp()

public SetaPDF_FormFiller_Xfa::getXmp (
void
): bool|string

Get the raw XFA (XML/XMP) from the PDF document.

See

isDynamic()

public SetaPDF_FormFiller_Xfa::isDynamic (
void
): bool

Checks if the XFA form is a dynamic or static form.

saveTemplate()

public SetaPDF_FormFiller_Xfa::saveTemplate (
[ boolean $onlyIfUpdated = false ]
): bool

Saves the template node to the PDF structure.

Parameters
$onlyIfUpdated : boolean

Save only if the template node was updated internally.

setData()

public SetaPDF_FormFiller_Xfa::setData (
null|string $xml
): void

Set the content of the data node.

Parameters
$xml : null|string
 
Exceptions

Throws SetaPDF_FormFiller_Exception

Throws Exception

setDefaultValue()

public SetaPDF_FormFiller_Xfa::setDefaultValue (
string $fieldName, mixed $value [, string $encoding = 'UTF-8' ]
): boolean

Set the default value for a specific field.

Parameters
$fieldName : string
 
$value : mixed
 
$encoding : string
 

setReadOnly()

public SetaPDF_FormFiller_Xfa::setReadOnly (
$fieldName, $readOnly
): bool

Set a field to read-only or to "open".

This method is called internally by the SetaPDF_FormFiller_Field_AbstractField method.

Parameters
$fieldName
 
$readOnly
 

setValue()

public SetaPDF_FormFiller_Xfa::setValue (
string $fieldName, mixed $value [, string $encoding = 'UTF-8' ]
): bool

Sets a value by a field name.

This method is called internally if a fields value is changed to keep the XML data in sync. It should be used manually with care.

Parameters
$fieldName : string
 
$value : mixed
 
$encoding : string
 

setXml()

public SetaPDF_FormFiller_Xfa::setXml (
DOMDocument|string $domDocumentOrXml
): void

Set the raw XFA (XML/XMP) structure.

Parameters
$domDocumentOrXml : DOMDocument|string
 
Exceptions

Throws SetaPDF_FormFiller_Exception

setXmp()

public SetaPDF_FormFiller_Xfa::setXmp (
DOMDocument|string $domDocumentOrXml
): void

Set the raw XFA (XML/XMP) structure.

Parameters
$domDocumentOrXml : DOMDocument|string
 
See

syncAcroFormFields()

Syncornizes the XFA form field values with the corresponding AcroForm fields.

If XML data were passed via the SetaPDF_FormFiller_Xfa method this method will ensure that the data in the corresponding AcroForm fields representations will get updated.

syncDataNode()

public SetaPDF_FormFiller_Xfa::syncDataNode (
void
): bool

Writes the data node back to the PDF document.