Structure and Operation

PDF template parts

3 separate parts

Each PDF template consists of 3 separate template parts for the standard areas of a document page,

  • the header template,
  • the document template and
  • the footer template.

In each example there is a total

  • 3 separate template selections for each of the 3 parts as well
  • 2 additional template selection groups, each containing all 3 parts.

The template selection group

Note: A template selection group contains all 3 template parts. When selecting a template selection group, all 3 template parts are also inserted.

On the “Document” tab you can optionally

  • select a part template (left list box)
  • or a whole template selection group (right list box).

Header and footer template selections are inserted on the corresponding tabs. When you insert a template selection group, it inserts both a header and a footer and the document itself. Each part can then be further processed individually.

PDF document

The placeholders

The placeholders are the heart of every PDF template. When you look at our PDF demos, the first thing that will catch your eye are these strange placeholders in the PDF template document.

Basically, a placeholder is of the format ${placeholder_name}. The placeholder name must always be adapted to the form field or runtime information that is to be inserted.

Placeholder for the Joomla Framework objects User and Input

  • Access to the User object: ${user:UserProperty}, so something like
    • ${user:name} or
    • ${user:id}.
  • Access to the input object: ${input:InputProperty}.

Placeholder for the current record

Access to the current record is mainly used in SQL statements, as described below.

  • Access to the dataset: ${item:itemProperty}, i.e. something like ${item:created}.

Placeholder for PDF document properties

  • [PNR] = Current page number
  • [NPS] = total number of pages,
  • [POP] = The expression ‘Current page number / Total page number’.
    Only supported in header and footer.

Placeholder for the current date

  • ${currentdate}

Data record selection when printing the PDF in the administration

Primary selection on the “Preview” tab

If you create PDF documents in the administration, you use the data record selection there to decide which data records are to be used. Only the data of the form to which the PDF template belongs is used to replace the placeholders in the PDF template.

This is your primary record selection. This primary record selection is done directly in the “Preview” tab.

There you have options like

  • the status”,
  • the selection of a record ID,
  • Number of records
  • and more.

Set the record ID parameter to 0 if you do not want to select a specific record by its ID.

Any change you make to the record selection is immediately applied to the next preview without manual “saving”. The data record selection is saved automatically in the background. With asynchronous AJAX calls, the changes are sent to the server and saved there.

Secondary selection by SQL sub-statements on the “Data selection” tab

It is possible to create any individual SQL sub-statements for the data set selection. This is done on the “Data selection” tab. The partial SQL statements stored on the “Data selection” tab can then later be selected in a list box on the “Preview” tab for generating the PDF document

This is the secondary record selection.

You store individual SQL WHERE sub-statements on the “Data selection” tab. These partial statements only refer to the part of a complete SQL statement that refers to the query conditions behind the so-called ‘WHERE’ keyword.

You write this partial statement without the keyword “WHERE”, so only the actual query conditions. It is precisely these query conditions that ultimately determine which data records are selected.

By writing the SQL sub-statements you have maximum possibilities for your data set selection. This makes the entire PDF feature much more flexible

It is possible to use placeholders in these partial statements. More in: Advanced SQL-Feature.

You can store up to 10 different SQL partial statements. After you have saved your changes, you can then use one of these SQL statements for the data set selection on the “Preview” tab with the list box for the “Data selection SQL” option.

data selection

Hierarchy of the different data selection options

When you create PDF documents in Administration, the record selection options are considered in the following hierarchy:

  • If you have selected a specific data record ID, this one data record will be used.
  • Have you entered a 0 as the record ID
    • all records are taken as the base selection or
    • if you chose a “Data selection SQL”, the data sets that this SQL sub-statement returns.

All other options are then applied to this preselection:

  • state,
  • limit,
  • Sorting
  • and other.
PDF Preview