Output document templates¶
An output document is built from a template: HTML with placeholders where the case data goes. This page covers how a template is written and what the document settings do when the file is generated.
Placeholders¶
A placeholder is the variable name with a prefix, exactly as in a condition:
<p>Dear @#CustomerName,</p>
<p>Invoice @#InvoiceNumber for @#Amount.</p>
@#Fieldwrites the value of the variable.- An unknown variable writes nothing; it does not stop the document.
- The value is inserted as text. If the variable holds HTML, it is escaped.
Tables from a grid¶
A grid is printed with a block that repeats for every row: the grid name opens it with
@> and closes it with @<.
<table>
<tr><td>Product</td><td>Price</td></tr>
@>Items
<tr><td>@#Product</td><td>@#Price</td></tr>
@<Items
</table>
Everything between @>Items and @<Items is repeated once per row, with the columns of
that row in place of the placeholders. If the block is not closed, the rest of the
document is swallowed by the repetition.
The document settings¶
| Setting | What it changes |
|---|---|
| Title | The name in the step and in the case document list |
| Description | Context for other designers |
| Filename | The name of the generated file |
| Output Document to Generate | Both, Doc, or Pdf |
| Media | The page size (A4 by default) |
| Landscape | Orientation of the page |
| Margins | Top, bottom, left and right |
| Header and Footer | Content repeated on every page |
| Report generator | TCPDF or HTML2PDF |
| PDF security | Opening and owner password, and the permissions |
| Versioning | Whether each generation creates a new version |
| Destination path | Where the file is stored |
Header and footer¶
Each document can carry a header and a footer, configured separately and applied to every page. Both offer the same parts:
| Part | What it does |
|---|---|
| Logo | An image, with its width and its position on the page |
| Title | A line of text, with font size and position |
| Page number | The current page |
| Page number total | Adds the total, so the line reads page 2 of 7 |
The title and the page-number text accept placeholders, so a header can carry the case number or the date of the document.
Images¶
An image in the template must be reachable by the server that generates the document: an absolute URL, or a file the process can read. A relative path that only exists in the editor renders as an empty box in the PDF.
Logos used in the header and footer follow the same rule.
Fonts¶
The generator uses the fonts installed on the server. A font the server does not have is replaced by the default one, which is why a document can look right in the editor and different in the case. Custom fonts have to be installed on the server, not just named in the CSS.
Page flow¶
The content flows into as many pages as it needs: margins, media and orientation come from the document settings, and a table that does not fit continues on the next page. A header or footer is repeated on each of those pages automatically.
What the PDF generator does to the HTML¶
- Page orientation and media come from the settings, not from the HTML.
- Old
<font>tags are converted to inline styles, so a template from an older version keeps its look. - The header and footer are applied to every page.
- A font that is not available on the server is replaced by the default one; that is the usual cause of a document that looks right in the editor and different in the case.
Doc documents¶
With Output Document to Generate set to Doc the same template produces a .doc file. Complex CSS is
not translated: tables and text survive, layout tricks such as floats usually do not.
When the layout matters, produce PDF.
When the document comes out wrong¶
| Symptom | Usually |
|---|---|
| A field is empty | The placeholder names a variable the case has not stored — check the spelling, the prefix, and that the step filled it |
| The rest of the document disappears after a grid | The @>Grid block is not closed with @<Grid |
| The layout differs from the editor | The renderer is not a browser: only part of the CSS survives, and unknown fonts are replaced |
| An image is a blank box | The path is not reachable from the server, or the file is not public |
| A table is cut at the page edge | The row is taller than the page; split it or reduce the content |
Versioning¶
When versioning is on, generating the document again does not overwrite the previous file: the case keeps both, and the document viewer shows the versions. That is what makes a generated document auditable.
Related¶
- Output documents — the document definition.
- Templates and public files — the files a process shares.
- Conditions — the prefixes used in a placeholder.
- Document viewer — how the generated file is shown.