setasign\SetaPDF2\FormFiller
Xfa Class offering access to XFA data of a PDF form.
File: /SetaPDF v2/FormFiller/Xfa.php
Old class name (alias):
\SetaPDF_FormFiller_Xfa
Class hierarchy
Summary
Methods
- __construct()
- _evaluateValue()
- _findPacketStream()
- _setValueInForm()
- cleanUp()
- getBridge()
- getData()
- getDomDocument()
- getFormFiller()
- getFormNode()
- getFormNodeChecksum()
- getObject()
- getTemplate()
- getXml()
- getXmp()
- isDynamic()
- saveFormNode()
- saveTemplate()
- setData()
- setDefaultValue()
- setReadOnly()
- setValue()
- setXml()
- setXmp()
- syncAcroFormFields()
- syncDataNode()
Properties
$_bridge
The bridge instance.
$_domDocument
The document instance of the full XDP packet.
$_formFiller
The form filler instance
$_template
The template node.
Static Methods
sanitizeDataXml()
Sanitize XML for the dataset package
This method removes duplicate namespace declarations which are created by PHPs DOM functionailites (when a namespaced node is imported and appended in setData()). Adobe products seems to "repair" this at runtime ending in different checksum-calculations in the form-tag.
This method also orders the namespace declarations, which seems to be a requirement by Adobe.
Parameters
- $xml : string
Exceptions
Methods
__construct()
_evaluateValue()
_findPacketStream()
Finds a packets stream by its name.
Parameters
- $array : \setasign\SetaPDF2\Core\Type\PdfArray
- $name : string
- $create : bool
Exceptions
_setValueInForm()
Creates the data node and sets the value in the form package.
Parameters
- $fieldName : string
- $value : mixed
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
getBridge()
Get the XFA bridge helper object.
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
getData()
Get the data node.
Parameters
- $create : bool
Exceptions
Throws \setasign\SetaPDF2\NotImplementedException
Throws \DOMException
Throws Exception
getDomDocument()
Get the \DOMDocument instance of the XFA structure.
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
getFormNode()
Get the form node.
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
getFormNodeChecksum()
Calculate and get the checksum for the form node.
Exceptions
Throws Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
getObject()
Get the XFA pdf object.
Exceptions
getTemplate()
Gets the template node from the XFA structure.
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
getXml()
Get the raw XFA (XML/XMP) data from the PDF document.
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
getXmp()
Get the raw XFA (XML/XMP) from the PDF document.
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
See
isDynamic()
Checks if the XFA form is a dynamic or static form.
Exceptions
saveFormNode()
Saves the form node to the XFA packages.
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
saveTemplate()
Saves the template node to the PDF structure.
Parameters
- $onlyIfUpdated : bool
Save only if the template node was updated internally.
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
setData()
Set the content of the data node.
Parameters
- $xml : ?string
Exceptions
Throws Exception
Throws \Exception
setDefaultValue()
Set the default value for a specific field.
Parameters
- $fieldName : string
- $value : mixed
- $encoding : string
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
setReadOnly()
Set a field to read-only or to "open".
This method is called internally by the Field\AbstractField::setReadOnly() method.
Parameters
- $fieldName : string
- $readOnly : bool
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
setValue()
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
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Font\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
Throws Field\Exception
setXml()
Set the raw XFA (XML/XMP) structure.
Parameters
- $domDocumentOrXml : \DOMDocument|string
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws Exception
setXmp()
Set the raw XFA (XML/XMP) structure.
Parameters
- $domDocumentOrXml : \DOMDocument|string
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws Exception
See
syncAcroFormFields()
Syncornizes the XFA form field values with the corresponding AcroForm fields.
If XML data were passed via the Xfa::setData() method this method will ensure that the data in the corresponding AcroForm fields representations will get updated.
Exceptions
Throws \DOMException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Font\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
Throws Field\Exception
syncDataNode()
Writes the data node back to the PDF document.
Parameters
- $force : bool
Ignore check of changes were made or not and update data node in any case. You need to set this to true if you e.g. modify the DOMNode returned by getData().
Exceptions
Throws Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws \DOMException
Throws Exception