TYPO3 Form Framework finisher that generates custom PDF files from form submissions.
- Custom PDF Engine: Generates PDFs via the mPDF library by overlaying Fluid HTML templates (containing form markers) onto pre-designed visual PDF background layouts.
- Flexible Email Attachments: Attaches generated PDFs directly to user and/or receiver emails safely via PSR-14 event listeners (
AttachPdfToMailListener), avoiding any overrides to TYPO3 core email finishers. - Granular Link Controls: Selectively exposes PDF permalinks (
generated_pdf_link) to standard or custom email templates based on targeted finisher checkboxes. This is dynamically injected per email execution usingBeforeRenderMailContentEventto keep the global form state clean. - FAL Storage & Headless Ready: Stores generated PDFs permanently in any configured TYPO3 FAL storage (e.g.,
1:/form_pdf/). Dynamically resolves complete absolute URLs for these links, ensuring flawless operation across traditional, Headless API, and proxy environments. - Secure Confirmation Downloads: Serves direct, downloadable PDF links in frontend confirmation messages with an optional auto-deletion feature for GDPR and data privacy compliance.
Available in composer mode only:
composer require t3brightside/form-pdf
Include the Form PDF Site Set in your site configuration.
Create two backend records in a SysFolder:
- PDF Template: High-resolution PDF background layout (e.g., stationary/letterhead).
- HTML Template: Fluid-styled template containing form field markers (e.g., {text-1}, {email-1}).
Examples are available in Documentation/example/.
- Open the TYPO3 Form Editor and edit your form definition.
- Add finisher and select Form to PDF (
PdfFinisher). - Position the PDF finisher before email or confirmation finishers.
- Assign your created PDF Template and HTML Template records.
- Set finisher options:
| Option | Type | Default | Description |
|---|---|---|---|
pdfTemplate |
Integer | "" | UID of the PDF template record. |
htmlTemplate |
Integer | "" | UID of the HTML template record. |
isPdfAttachedToReceiver |
Boolean | false | Attach PDF file to receiver email. |
isPdfAttachedToUser |
Boolean | false | Attach PDF file to user email. |
openPdfNewWindows |
Boolean | false | Include download link in confirmation screen. |
forceDownload |
Boolean | false | Force direct browser download (skip inline preview). |
deleteAfterDownload |
Boolean | false | Delete temporary file immediately after download link click. |
storeOnServer |
Boolean | false | Store PDF permanently on server (FAL storage). |
isPdfLinkAttachedToReceiver |
Boolean | false | Enable PDF permalink in receiver mail. |
isPdfLinkAttachedToUser |
Boolean | false | Enable PDF permalink in user mail. |
storagePath |
String | "" | FAL folder identifier (e.g. 1:/form_pdf/ or 2:/formfiles/). Folders are auto-created if missing. |
filenamePattern |
String | "{timestamp}-{formIdentifier}.pdf" | Stored filename pattern. Supports placeholders. |
The filenamePattern option supports the following placeholders:
| Placeholder | Description |
|---|---|
{timestamp} |
Unix timestamp |
{datetime} |
Current date and time in YmdHi format |
{date} |
Current date in Y-m-d format |
{formIdentifier} |
TYPO3 form identifier |
{text-1} |
Values from any form field identifier |
- The extension persists the generated PDF into the target FAL folder (
storagePath). - The public URL is dynamically resolved to a complete absolute URL (handling origin headers, reverse proxies, and site base configurations).
- The
ModifyPdfLinkForEmailListenerintercepts theBeforeRenderMailContentEventduring email processing:- If Enable link to PDF in receiver mail is enabled -> injects
generated_pdf_linkfor receiver emails. - If Enable link to PDF in user mail is enabled -> injects
generated_pdf_linkfor user emails. - If disabled -> strips
generated_pdf_linkfromFormStateandFormDefinitionso default<formvh:renderAllFormValues />templates omit the field.
- If Enable link to PDF in receiver mail is enabled -> injects
storagePathmust point to a publicly reachable FAL storage.- The extension generates public URLs using
File::getPublicUrl(). Token-protected downloads are out of scope. - Form submissions may contain sensitive personal data (PII). If so, ensure target folders disable directory listings, prevent search engine indexing, and be password protected if needed.
While the extension is designed to instantly clean up temporary files immediately after a PDF is generated or downloaded, edge cases can occur. For example:
- A user submits the form but closes the browser before clicking the "Download" link.
- The server experiences a timeout or memory limit crash during PDF generation.
- Confirmation link files are not set to autodelete but files should not be kept forever.
To prevent your var/transient/ directory from filling up with orphaned files, the extension provides a TYPO3 Symfony Command that acts as a garbage collector.
Go to the TYPO3 Backend and set System > Scheduler > Formpdf > formpdf:clean.
For deployments or manual execution, you can also trigger the cleanup command directly from your terminal:
# Clean files older than 1 day (default)
vendor/bin/typo3 formpdf:clean
# Clean files older than 30 days
vendor/bin/typo3 formpdf:clean --days=30
# Clean all temporary PDF files immediately
vendor/bin/typo3 formpdf:clean -d 0The finisher uses Confirmation.html for confirmation views. To override this in your site package:
TYPO3:
CMS:
Form:
prototypes:
standard:
finishersDefinition:
Confirmation:
options:
templateName: Confirmation
templateRootPaths:
20: 'EXT:my_sitepackage/Resources/Private/Templates/Form/Finishers/'The finisher registers variables in the FinisherVariableProvider under the Pdf identifier:
<f:if condition="{finisherVariableProvider.Pdf.storedPublicUrl}">
<f:if condition="{finisherVariableProvider.Pdf.isPdfLinkAttachedToReceiver}">
<a href="{finisherVariableProvider.Pdf.storedPublicUrl}">Download PDF</a>
</f:if>
</f:if>Available provider keys:
{finisherVariableProvider.Pdf.storedPublicUrl}
{finisherVariableProvider.Pdf.storedFilename}
{finisherVariableProvider.Pdf.storedFileUid}
{finisherVariableProvider.Pdf.isPdfLinkAttachedToReceiver}
{finisherVariableProvider.Pdf.isPdfLinkAttachedToUser}- GitHub Repository: https://github.com/t3brightside/form_pdf
- Packagist: https://packagist.org/packages/t3brightside/form-pdf
Tanel Põld
- GitHub: https://github.com/t3brightside/
Mykola Orlenko
- GitHub: https://github.com/okolya
Maintained by Brightside OÜ – TYPO3 development and web agency specializing in high-performance web applications.