The Main Class All work has to start with this class

Introduction

While the FormFiller component is created by several classes there's only one class that has to be initated: The SetaPDF_FormFiller class.

Other class instances will be generated automatically, internally and will get returned by specific getters, as you will find out in this manual.

Get an Instance

The one and only parameter to the constructor of the SetaPDF_FormFiller class is a document instance. The PDF document that is represented by this instance should hold at least some form fields or a dynamic XFA form. Otherwise the FormFiller component will not bring you any noticeable feature. 

Reading and writing the PDF document is up to the Core component. This way it is possible to work on the document instance further:

PHP
$document = \SetaPDF_Core_Document::loadByFilename('path/to/an/acroform.pdf');

$formFiller = new \SetaPDF_FormFiller($document);

...

// access the classes/functionallities via the Core component
$document->getCatalog()->setPageLayout(\SetaPDF_Core_Document_PageLayout::ONE_COLUMN);

Saving a Filled Form

Until version 2.5 the FormFiller instance offered a save() method that updated the modification date and removed XFA information if necessary. It is marked as deprecated as of version 2.5 because this is done automatically if the save() method of the document instance is called. 

Saving has to be done through the document instance throughout:

PHP
$document = \SetaPDF_Core_Document::loadByFilename(...);
$formFiller = new \SetaPDF_FormFiller($document);
...
$document->save()->finish();