Getting started

System Requirements and Installation

Because the SetaPDF-FormFiller component is based on the SetaPDF-Core component its system requirements and installation are almost identically.

Additionally the SetaPDF-FormFiller component requires following extensions to be installed:

Loading the Component

The SetaPDF-FormFiller component makes use of classes and methods of the SetaPDF-Core component. The FormFiller component itself is integrated into the same structure and is fully covered by the autoload function of the Core component.

Loading the SetaPDF-FormFiller component is that simple:

PHP
require_once('/absolute/path/to/library/SetaPDF/Autoload.php');

or

PHP
require_once('../relative/path/to/library/SetaPDF/Autoload.php');

If the component is installed via Composer, just use the autloader instance from Composer:

PHP
require 'vendor/autoload.php';

Error Handling

Beside the mentioned exception in the Core manual the FormFiller component has its own base exception: SetaPDF_FormFiller_Exception.

If XFA forms are used the component makes heavy use of PHPs DOM functionalities to load and handle the XML content/packets.Sadly most of the DOM methods will trigger errors instead of throwing exceptions in case of a problem or error. For example, simply passing an invalid XML string to the loadXML() method will trigger an E_WARNING which may be annoying in the most cases. So it's up to the developer to check these data before passing it to the component. Anyhow the component will detect the problem too and throw additionally an exception.

To avoid warning you could also disable the libxml errors (on which the DOM extension is based upon) with the libxml_use_internal_errors() function.

PHP
libxml_use_internal_errors(true);
try {
    // ....
    $xfa->setData('<invalid>XML</innvalid>');
    // ...
} catch (Exception $e) {
    // handle exception
    // ...
    // handle details about the libxml errors
    foreach (libxml_get_errors() as $error) {
        var_dump($error);
    }
}