Open Gauge
Document Templates

Document Templates

A WYSIWYG editor for designing reusable calibration certificate and procedure layouts.

A document template is a reusable layout for a printable document — a calibration certificate or a calibration procedure — designed once and populated with real data every time it's generated. Manage them from Admin Panel → Templates, a collapsible group in the admin sidebar with two panels: Calibration Reports (this editor's certificate-type templates, alongside hand-authored LaTeX ones — see Certificate templates) and Procedures. Both panels share the same layout and actions — see Managing templates: base, default, and enabled below. Each panel's "+ New template" button opens a modal (LaTeX import only appears on the Calibration Reports panel, since procedures have no legacy .tex system); "Create new template" is the option that opens this editor for a blank template. Export/import and generation are covered in PDF generation below.

Two template types

  • Calibration Certificate — exposes asset, calibration, measurement, coefficient/statistics, uncertainty, technician, laboratory, and certificate-metadata variables.
  • Calibration Procedure — exposes equipment, procedure metadata, environmental conditions, steps, acceptance criteria, safety instructions, technician, approval, and revision-history variables.

Only the variables relevant to a template's type are shown while editing it.

Managing templates: base, default, and enabled

Each panel (Calibration Reports, Procedures) lists every template of that kind as one row — LaTeX and editor templates share the same row layout — with three concepts that work identically in both panels:

  • Base — every kind ships with one permanent "Open Gauge (default)" row, always listed first. It's created automatically the first time you open that panel (or the first time a document of that kind is generated with nothing configured) — nothing to set up on a fresh install. It can't be edited or deleted, but its Default/Active state toggles like any other row.
  • Default — exactly one enabled template per kind is the default, used whenever a document is generated without a specific template chosen (see PDF generation and Downloading a procedure as PDF). Click the checkmark on any other row to make it the default instead — the previous default is cleared automatically. If nothing is ever marked default, the base template is. On the Calibration Reports panel this is a single default shared across both LaTeX and editor templates — marking an editor template default clears a LaTeX default and vice versa.
  • Active — every template also has an Active toggle, independent of Default. Switching a template off removes it from the download picker (it can no longer be selected, by default or explicitly) while leaving it exactly where it is in the list — still visible, still editable, still easy to switch back on. This is different from Delete, which soft-removes a template from the list entirely. The base template can't be switched off while it's the current default (there would be nothing left to fall back to) — mark another template default first. Switching off (or deleting) the current default falls back to the base template automatically.

The editor layout

The editor is a three-panel desktop layout, not a scrolling web page — the center panel renders the document as a physical A4 (or Letter) page, at the same proportions it will eventually print at.

  • Tools (left) — click or drag an element onto the page to insert it: text (heading, paragraph, divider, page break), data (variable, table, measurement table, key/value field), technical (equation, graph, calibration data plot, image, QR code, signature, date, page number), and layout (columns, spacer, section, header, footer).
  • Page canvas (center) — click any text to edit it in place; a contextual formatting toolbar (font, size, bold/italic/underline, alignment, color, highlight, line/paragraph spacing, lists) appears above the page while a text block is selected. A block's own structured settings (a table's rows/columns, a graph's axes, a QR code's payload, …) are edited from the Block tab on the right.
  • Variables (right) — search or browse every variable available for the template's type, grouped by category (Asset, Calibration, Calibration Results, Measurements, Organization, User/Technician, Dates, …). Clicking one inserts it into the selected text block, or appends a new paragraph if nothing is selected. A collection variable (e.g. Measurements) is shown apart from scalar variables and can be inserted as a ready-made repeating table.

Template vs. Preview Data mode

Switch between Template mode — showing raw {{ variable }} tokens — and Preview Data mode, which substitutes every token with realistic sample values (e.g. {{asset.id}} → OG-000123) so you can see roughly what a generated document will look like before any real calibration exists. A repeating table bound to a collection variable renders one sample row per sample data point in Preview mode.

The document model

A template's content is stored as structured JSON — an array of typed blocks (heading, table, equation, qr_code, …), each with its own properties — never as an HTML string. This keeps the editor's output reproducible by a future server-side PDF renderer, which will walk the same block tree the browser draws rather than trying to reinterpret arbitrary HTML/CSS.

Page layout (size, orientation, margins, default typography) and the repeating header/footer are document-level settings, edited from the Document tab on the right — header and footer content repeats on every page a generated PDF produces.

Versioning and publishing

A template's history works like calibration history: immutable and traceable.

  • A new template starts as version 1, draft — editable, autosaved as you work.
  • Publish freezes that version. A published template can no longer be edited in place — it may already have been used to generate real certificates.
  • Editing a published template branches a new draft version (version + 1) in the same template group; publishing that draft supersedes the previous one. If a draft already exists, editing again reopens that same draft rather than creating another one.
  • Duplicate instead creates a brand-new, independent template (its own version history) pre-filled with the source version's content — for starting a variant rather than continuing the same one.
  • Archive hides a template from the default list without deleting its history.

Images

Images (a company logo, an accreditation mark, a diagram) are uploaded per template and stored as file references — an image block holds a file_id and a resolved preview URL, not an embedded copy of the file's bytes.

Export and import

A template can be exported to a portable JSON file (its name, description, type, and full document) and re-imported elsewhere — as a new draft, its own independent version history — via "+ New template" → "Import JSON template". As with the LaTeX import option, the modal shows a live preview of the selected file and lets you override the name and starting version number before creating the draft. Unlike a raw .tex upload, an exported template round-trips through this same editor: import it, keep editing, publish. It isn't LaTeX — that's generated automatically at PDF time (see below), not something you author or exchange directly.

PDF generation

A published editor template can generate a real calibration report PDF, the same way an uploaded .tex certificate template does. Under the hood, the template's structured JSON document is converted to LaTeX and compiled with the same Tectonic pipeline — no separate PDF engine, no separate escaping rules to learn. Equation blocks already store raw LaTeX, so they pass straight through; every other block (text, tables, repeating rows bound to a collection, graphs, QR codes, columns, …) is translated automatically.

A published Calibration Procedure template renders the same way, but for a procedure rather than a calibration — see Downloading a procedure as PDF. There's no channel/organization resolution chain for procedures (a procedure isn't tied to a sensor channel the way a calibration report is): the Download PDF button on a procedure's detail page lets you pick any published, active procedure template directly, or leave it on whichever one is currently marked Default in Admin → Templates → Procedures (see Managing templates above).

Assigning a default template to a channel

The rest of this section (channel/calibration-level assignment) applies to Calibration Certificate templates only.

Open a sensor channel's editor (Assets → an asset → Overview → Edit) and set Default report template to any published, active template, of either kind (uploaded .tex or editor-authored). Every calibration recorded against that channel uses it unless overridden individually (below). Leave it unset to fall back to the organization's default, then whichever template is marked Default in Admin → Templates → Calibration Reports (the base template, if nothing else has been marked).

Overriding the template for one calibration

On a calibration's detail page, the Download button's chevron menu lets a user with edit rights (any role above Viewer) pick a specific template for that calibration alone — this choice is persisted, not a one-off render: it becomes what every user downloads for that calibration going forward, until changed again or cleared back to "Default template". A Viewer never sees this menu — they always get whichever template the override, channel default, or org/global fallback resolves to, with no choice of their own.

On this page