Templates

Templates define the content, layout, and paper settings used when FormPDF PRO generates a PDF from an Express form submission.

Use this section when you need to create a template, edit an existing template, preview output, validate template content, or manage template lifecycle actions from the Templates list.

Create a PDF Template

Use this flow to create the first draft of a PDF layout that can later be connected to an automation rule.

  1. Open Dashboard > FormPDF PRO > Templates.
  2. Click Add Template.
  3. Enter a Name. This field is required.
  4. Optionally enter a Description to help other administrators understand how the template is used.
  5. Select a Status. New templates default to Draft.
  6. Select a Source type:
    • Basic: configure Header content, Footer content, Font family, Font size, Section title, and the Show empty fields toggle.
    • HTML: write or paste HTML in the Ace editor with syntax highlighting and language tools.
    • External: enter the server-side template path in File path (must be within the site root).
  7. Select the Paper size: A4, Letter, Legal, or A3.
  8. Select the Orientation: Portrait or Landscape.
  9. Optionally select an Express entity to provide token auto-complete context while editing.
  10. Optionally click Validate to check the template. See Validate a Template.
  11. Optionally use the preview launcher to generate a sample PDF. See Preview a Template.
  12. Click Save template.

After success, the template is saved as a draft, a thumbnail is generated automatically, and you are returned to the Templates list.

Note: A template must be connected to a rule before it can generate PDFs from submitted forms. See Create a Rule.

Server-side validation can block saving. Common causes include unbalanced token placeholders, invalid HTML, very large template content or source settings, or a missing external file path. When validation fails, errors are shown on the form and the template is not saved.

External file template

Use External file template when the PDF layout already lives in a readable file under the Concrete site root. This source type is ideal for version-controlled templates, developer workflows, and shared templates across multiple sites.

How it works

  1. File read: FormPDF PRO reads the file from the server filesystem as raw text. PHP code inside the file is not executed.
  2. Token resolution: Token placeholders such as {{ field_handle }} are resolved with data from the Express form submission.
  3. PDF rendering: The resolved HTML is sent to PDF Engine for generation using the template's paper size and orientation settings.

Accepted file extensions

Extension Status Notes
.html Recommended Standard HTML template file
.htm Recommended Same as .html
.php Not recommended Read as raw text — PHP code is not executed. Consider renaming to .html

Other extensions are accepted but will produce a validation warning.

Example paths

All paths are relative to the Concrete site root (DIR_BASE):

  • application/views/pdf/invoice.html — custom template in the application directory
  • application/templates/receipt.htm — receipt layout stored alongside other app templates
  • packages/my_package/templates/report.html — template shipped inside a package

Token usage in external files

External files support the same {{ token }} syntax as Basic and Internal HTML source types:

Token Description
{{ field_handle }} Value of the form field with that handle
{{ form_name }} Name of the Express entity (form)
{{ submission_date }} Date the form was submitted
{{ submission_id }} Unique submission identifier

Token filters are also supported:

  • {{ field_handle|upper }} — converts to uppercase
  • {{ field_handle|lower }} — converts to lowercase
  • {{ field_handle|date('Y-m-d') }} — formats a date value

Limitations

  • PHP code inside .php files is not executed. The file is read as raw text only.
  • Remote URLs (https://...) are rejected.
  • Path traversal (..) is blocked.
  • Files outside the site root directory are blocked at both validation and render time.
  • PDF Engine CSS 2.1 restrictions apply: avoid flexbox, grid, and modern CSS features. Use tables for layout.
  • This source type is completely separate from Concrete mail templates in /application/mail/.

Preview and save both use the referenced file. If the file is missing, unreadable, outside the site root, or configured with a remote URL, the form shows a validation or preview error.

Edit an Existing Template

Use this flow to update the content, source settings, status, or paper settings of an existing template.

  1. Open Dashboard > FormPDF PRO > Templates.
  2. Find the template you want to change.
  3. Click Edit.
  4. Review the pre-filled template form.
  5. Update the same fields used when creating a template:
    • Name
    • Description
    • Status
    • Source type
    • Paper size
    • Orientation
    • Express entity
  6. Optionally click Validate. See Validate a Template.
  7. Optionally generate a preview. See Preview a Template.
  8. Click Save template.

After success, the template is updated, the thumbnail is regenerated, and you are returned to the Templates list.

Note: Editing uses the same form and validation rules as creating a template. If the template is already used by active rules, changes affect future PDF generation for those rules.

Preview a Template

Use this flow to render a PDF preview before saving or before connecting the template to live automation.

  1. Open the template add/edit form.
  2. In the preview launcher panel, select a preview mode:
    • Sample data: FormPDF PRO uses placeholder values.
    • Real entry: select an Express entity, then select a specific entry loaded through AJAX.
  3. Click Generate preview.
  4. Review the generated PDF preview. If your browser opens the PDF in a new tab instead of the inline preview area, return to the template form when finished.

After success, you see a rendered PDF preview using either sample values or data from the selected Express entry.

Note: Preview generation can fail when the current template data does not validate, or when rendering fails. If Real entry mode has no available submissions, the entry dropdown is empty. In that case, submit the related Express form first or use Sample data.

Previewing is optional but recommended before you connect a template to active rules. See Create a PDF Template and Edit an Existing Template.

Validate a Template

Use this flow to check template content for token and HTML issues before saving.

  1. Open the template add/edit form.
  2. Click Validate.
  3. FormPDF PRO checks the content on the server.
  4. The server checks token placeholders.
  5. The server checks HTML structure.
  6. Review the validation panel:
    • Score badge, for example 85/100.
    • Errors in red. These are blocking issues.
    • Warnings in yellow. These are non-blocking issues.
    • Suggestions in blue. These are improvement hints.

After success, the validation panel displays a score and categorized feedback so you can decide what to fix before saving.

Note: The Validate button checks HTML content and token placeholders. Additional save-time validation may block saving for source-specific problems, such as missing external file paths or invalid source settings.

If validation fails because of a server error, the panel shows a generic error. If save fails later, fix the errors shown on the form and click Save again.

Manage Template Lifecycle

Use this flow to change a template's status, duplicate a template, or delete a template from the Templates list.

  1. Open Dashboard > FormPDF PRO > Templates.
  2. Find the template card you want to manage.
  3. Choose one of the available actions:
    • Activate: changes a draft or paused template to active.
    • Pause: changes an active template to paused.
    • Archive: moves a template out of active use.
    • Restore: restores an archived template to draft.
    • Duplicate: creates a copy of the template with (Copy) added to the name.
    • Delete: permanently deletes the template. Do not delete templates attached to active rules; archive them instead.
  4. If you click Delete, confirm the browser prompt: “Are you sure you want to delete this template? This action cannot be undone.”

After success, you are returned to the Templates list with a confirmation message. Status changes, duplication, and deletion are submitted with POST requests and CSRF protection.

Common status transitions:

DRAFT → ACTIVE → PAUSED → ARCHIVED → Restore → DRAFT

Warning: Do not delete templates that are attached to active rules. If you need to remove a referenced template from use, archive it first and update the affected rules before deleting it.

Deleting a template is a hard delete. If you only want to remove a template from active use, choose Archive instead.