Fill PDF AcroForms with PHP


Fill in existing PDF forms with PHP

Create Individual Field Appearances

In normal situations the SetaPDF-FormFiller component will render a PDF form fields appearance for you. This rendering process is limited to default PDF form field types which are very limited in view to their layout capacities.

As already shown in the demo "Fill field with an Image" it is possible to create a field appearance manually and pass it to the field instance. This demo will go a step further and will get the appearance information from a JSON string that is defined as a text fields value. The dynamic data (in this case simple text strings) will be rendered based on this information.

At the end the form field appearances will get flattened to the pages content, so that they become part of the page itself and are not displayed through an widget annotation. The result will be a flat PDF document without PDF form fields.

The appearances in this demo are created with SetaPDF functionalities and are actually limited to "text". It should give you a clue about what you can create with this logic. A text can be configured e.g. like this:

    "type": "text",
    "fontFamily": "helvetica",
    "fontStyle": "B",
    "fontSize": 5,
    "color": [200, 200, 200],
    "align": "C"

The script will create the field appearances based on this information. To get more details, simply check the script output below and/or open the example PDFs by simply double-clicking them.

Select or upload a file

The uploaded files are bound to your browser session and are not accessible by any other user. They will get deleted after 24 hours automatically.