PHPackages                             cgoit/contao-form-fill-pdf-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. cgoit/contao-form-fill-pdf-bundle

ActiveContao-bundle[Templating &amp; Views](/categories/templating)

cgoit/contao-form-fill-pdf-bundle
=================================

Fill PDF forms based on forms in contao

1.4.7(1mo ago)0151LGPL-3.0+PHPPHP ^8.2CI passing

Since Nov 7Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/cgoIT/contao-form-fill-pdf-bundle)[ Packagist](https://packagist.org/packages/cgoit/contao-form-fill-pdf-bundle)[ Docs](https://cgo-it.de)[ GitHub Sponsors](https://github.com/cgoIT)[ Fund](https://ko-fi.com/cgoit)[ RSS](/packages/cgoit-contao-form-fill-pdf-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (22)Used By (0)

Contao Form Fill PDF Bundle
===========================

[](#contao-form-fill-pdf-bundle)

[![Latest Version on Packagist](https://camo.githubusercontent.com/db28a71c977bdf72122091de3dc5e14750013883c11ad47d5f6e1b5a232b11c1/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63676f69742f636f6e74616f2d666f726d2d66696c6c2d7064662d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/cgoit/contao-form-fill-pdf-bundle)[![Dynamic JSON Badge](https://camo.githubusercontent.com/ab5cbe90e5c15d760507117b15555677c242bb3e24e2cc48d8312daa9e01e456/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f75726c3d68747470732533412532462532467261772e67697468756275736572636f6e74656e742e636f6d25324663676f4954253246636f6e74616f2d666f726d2d66696c6c2d7064662d62756e646c652532466d61696e253246636f6d706f7365722e6a736f6e2671756572793d2532342e72657175697265253542253232636f6e74616f253246636f72652d62756e646c65253232253544266c6162656c3d436f6e74616f25323056657273696f6e)](https://camo.githubusercontent.com/ab5cbe90e5c15d760507117b15555677c242bb3e24e2cc48d8312daa9e01e456/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f75726c3d68747470732533412532462532467261772e67697468756275736572636f6e74656e742e636f6d25324663676f4954253246636f6e74616f2d666f726d2d66696c6c2d7064662d62756e646c652532466d61696e253246636f6d706f7365722e6a736f6e2671756572793d2532342e72657175697265253542253232636f6e74616f253246636f72652d62756e646c65253232253544266c6162656c3d436f6e74616f25323056657273696f6e)[![Installations via composer per month](https://camo.githubusercontent.com/8f77d5d56b943e6cc8947846ee749c2c85b56df2ebb2c62cbe1ce85d9a72cb1b/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f63676f69742f636f6e74616f2d666f726d2d66696c6c2d7064662d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/cgoit/contao-form-fill-pdf-bundle)[![Installations via composer total](https://camo.githubusercontent.com/cdcd3ded41424440bbacdfaddaa5833ca94f22dcd1fa7f0edd6e1a60e844ac47/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63676f69742f636f6e74616f2d666f726d2d66696c6c2d7064662d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/cgoit/contao-form-fill-pdf-bundle)

With this bundle you are able to fill PDF forms with the submitted data of any contao form.

Setup
-----

[](#setup)

Setup is currently only possible by composer or the contao manager. Just require or search for `cgoit/contao-form-fill-pdf-bundle` and install it.

Requirements
------------

[](#requirements)

***IMPORTANT***: The bundle requires [`pdftk`](https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) binary to be present on the server. If the `pdftk` binary is not present or usable on your server you can't fill your PDF templates with this bundle.

It might be possible that you can provide the appropriate binary for your architecture and set your `LD_LIBRARY_PATH` accordingly but this is not tested and I can't give you any guarantee that this will work.

How does this bundle work?
--------------------------

[](#how-does-this-bundle-work)

To be honest: this bundle doesn't do much on it's own. Most of the hard work of merging your data with the PDF template is done by the outstanding library [`php-pdftk`](https://github.com/mikehaertl/php-pdftk). This bundle only prepares all the data which is then provided to this library together with the selected PDF template. Thus all the limitations (e.g. UTF-8 support, etc.) of the `php-pdftk` library are also limitations of this bundle.

How to use?
-----------

[](#how-to-use)

### Prepare your PDF template

[](#prepare-your-pdf-template)

First of all you need a PDF template in which you will merge your form data. You can create your template with every tool which is able to create PDF forms. Inside of this template give your form fields names with SimpleTokens. Doing so, the data will be merged into this fields afterwards.

You can use the following SimpleTokens:

- `##form_*##`: `*` is the name of your form field in the contao form
- `##formconfig_*##`: `*` is a property of your contao form, e.g. `id`
- `##admin_email##`: the email of the administrator
- `##filenames##`: a list of submitted filenames

#### Special cases

[](#special-cases)

Currently I know three special cases where we have to talk about.

1. Radio buttons: If you have a radio button menu in your HTML form you'll have to take care that the `on`-value in your PDF form matches the corresponding values in your HTML radio button. E.g. if your radio button is named `test` with the values `1`, `A` and `all` you'll have to add three radio buttons to your PDF form as well. All of them are named `##form_test##`. The `on` values for the radiobuttons are `1`, `A` and `all`.
2. Checkboxes: When you have checkboxes in your form the user normally is able to check multiple of them in the frontend. Every checkbox will have a different value. In your PDF template you'll have to append this value prefixed with an underscore to the fieldname. E.g. if your checkbox in your HTML form is named `test` with the values `1`, `A` and `all` your fieldnames in your PDF template will be `##form_test_1##`, `##form_test_A##` and `##form_test_all##`. The `on` value of the checkboxes in the PDF form is always `1` for those fields.
3. File upload: Currently it's not possible to include the file itself in the merged PDF. If you add a file to your PDF only the path (as string) will be merged.

### Prepare your form

[](#prepare-your-form)

In the configuration of your form you can enable the merging of data into your PDF templates via checking `Merge PDF template`

[![Enable the merging of data into PDF templates](docs/enable-merging.png)](docs/enable-merging.png)

You then have to configure at least one PDF template which should be merged.

[![Configure the merging of data into a PDF template](docs/merge-configuration.png)](docs/merge-configuration.png)

OptionDefault valueDescriptionName-The name for your configuration. This name will be used to extend the SimpleTokens. If you have installed the [`terminal42/notification_center`](https://github.com/terminal42/contao-notification_center) you are able to attach the merged PDF to a notification email. To do so you'll have to attach the file via the SimpleToken `##form_` where `` is equal to the value of this option.PDF template-The template which has the form fields which should be filled.Storage location for merged PDF templates-The path where the merged PDFs should be stored.Template for file name of the merged PDF&lt;Form id&gt;\_{{date::Ymd}}The filename template. You can use SimpleTokens (`##form_*##`, `##formconfig_*`, ...) and InsertTags (`{{date}}`, `{{env::host}}`, ...) as variables in the filename template.
**You shouldn't add the extension `.pdf` to the name template because this filename extension is added automatically in the backend!**Insert tag prefix\[\[The prefix to use for InsertTags. You can use this InsertTag e.g. in hidden fields of your form (see explanation down below for further information).Insert tag suffix\]\]The suffix to use for InsertTags. You can use this InsertTag e.g. in hidden fields of your form (see explanation down below for further information).Flatten form fieldsfalseIf checked all the form fields are removed from the result PDF after merging your data.Save in leadsfalseIf you have installed the [`terminal42/contao-leads`](https://github.com/terminal42/contao-leads) bundle you can store the merged PDF also in your leads.Compatibility with other extensions
-----------------------------------

[](#compatibility-with-other-extensions)

As described above this extension works perfectly well with `terminal42/notification_center` and `terminal42/contao-leads`. There is also a solution if you want to combine this extension with `terminal42/contao-mp_forms`.

### Use with `terminal42/contao-mp_forms`

[](#use-with-terminal42contao-mp_forms)

If you have the use case to collect some data in a multi step form created with `terminal42/contao-mp_forms` **and** want to show the merged PDF e.g. on the summary step **before** you finally submit the form you can add a new FormField `Generate PDF` in your form configuration. If this FormField is present it will merge the data which is collected until this step into the selected PDFs. Doing so you can refer to the merged PDF via the well-known Simple Tokens described above.

How to test
-----------

[](#how-to-test)

To make things easy a sample pdf template and a sample form is included in this bundle.

During installation/migration the sample PDF form as well as a sql script is copied to `files/form-fill-pdf`. You can import the `contao-form-fill-pdf-demo-form.sql` into your database. This will create a form in contao with every possible form field type (textfields, check box menus, password fields, ...). The also copied `sample-form.pdf` can be used to merge the data from this contao form.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance90

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 75.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Recently: every ~94 days

Total

19

Last Release

46d ago

PHP version history (3 changes)v1.0.0PHP ^8.1 || ^8.2

1.2.0PHP ^8.1 || ^8.2 || ^8.3

1.4.4PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d593eb65a20bf8aa0034a97016bdde26047857dd221ce07d8fd3f084c103b46?d=identicon)[cgo-it](/maintainers/cgo-it)

---

Top Contributors

[![cgoIT](https://avatars.githubusercontent.com/u/8972203?v=4)](https://github.com/cgoIT "cgoIT (74 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

pdftemplatecontaoform

### Embed Badge

![Health badge](/badges/cgoit-contao-form-fill-pdf-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/cgoit-contao-form-fill-pdf-bundle/health.svg)](https://phpackages.com/packages/cgoit-contao-form-fill-pdf-bundle)
```

###  Alternatives

[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[codefog/contao-news_categories

News Categories bundle for Contao Open Source CMS

3183.3k6](/packages/codefog-contao-news-categories)[terminal42/contao-node

Node bundle for Contao Open Source CMS

3172.5k4](/packages/terminal42-contao-node)[terminal42/dcawizard

dcaWizard extension for Contao Open Source CMS

10370.7k15](/packages/terminal42-dcawizard)[contao/manager-bundle

Provides the Contao Managed Edition

181.3M61](/packages/contao-manager-bundle)[contao-community-alliance/dc-general

Universal data container for Contao

1578.3k86](/packages/contao-community-alliance-dc-general)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
