Skip to main content

How to Create PDF Templates in Bricks

Updated today

The PDF Template system allows you to define reusable HTML-based layouts that can be rendered as PDFs in Bricks Forms via the PDF Generator action or PDF Button.

This feature requires the Dynamic Shortcodes plugin to be active.

Settings

Each template provides the following configuration options via metaboxes:

  • HTML: A code editor where you define the HTML and inline CSS that will be used to render the PDF. You can use Dynamic Shortcodes syntax and templating tags.

  • Preview: A button to preview the rendered PDF based on test data.

  • Dimensions: Select the paper size (A4, A5, etc.) and orientation (Portrait or Landscape).

  • Available Fonts: Displays a list of core and custom PDF fonts usable via font-family in your CSS.

  • Preview Data: Define mock form data using the format field_name|value. For fields with multiple values, use comma-separated values.

  • Preview Post (optional): Allows you to select a post to simulate post-related data in the preview.

The HTML editor supports all Dynamic Shortcodes syntax including:

  • {form:field_id}: Replace with form field value

  • {for:label {form:field @raw} [<li>{get:label}</li>]}: Loops

  • {data:page-number}, {data:number-of-pages}: Pagination markers

Style

You can control the appearance of your PDF entirely through HTML and CSS inside the code editor. You can assign page headers using <htmlpageheader> syntax, use inline styles, and specify fonts available in the PDF Fonts system.

Usage Summary

  1. Navigate to PDF Templates in the WordPress admin.

  2. Create a new template and define your HTML layout using available shortcodes and data tags.

  3. Optionally set up preview data and a preview post to simulate dynamic values.

  4. Save and publish the template.

  5. Use this template inside a Bricks Form via the PDF Generator action or in PDF Button.

This feature is ideal for creating reusable layouts for invoices, reports, confirmation documents, or any dynamic content rendered as PDF.

Did this answer your question?