Template Components

Template Settings

Reference for templateSettings in VaultPDF. Controls locale, date/time formatting, number and currency display, boolean labels, section numbering, Table of Contents, watermarks, and security.

Overview

templateSettings is a top-level key placed on the JSON payload (or the template's docDefinition) that governs global rendering behaviour. All properties are optional - omitting a setting preserves the existing default, so existing templates are never affected by adding the key.

{
  "templateSettings": { },
  "salesOrders": [ ]
}

Locale & Date / Time

Controls how dates, times, and locale-sensitive values are formatted across the entire document.

PropertyTypeDefaultDescription
timezonestring"UTC"IANA timezone identifier applied to all date/datetime formatting.
localestring"en-US"BCP 47 locale tag used by Intl.NumberFormat for number and currency values.
dateFormatstring"M/D/YYYY"Display format for date-only values. Accepts moment.js tokens.
dateTimeFormatstring"M/D/YYYY, h:mm A"Display format for datetime values. Accepts moment.js tokens.
inputDateFormatstringnoneParsing pattern for incoming non-ISO date strings. Supported tokens: YYYY MM M DD D. Without this, non-ISO strings are returned as-is with a console warning.

European locale:

{
  "templateSettings": {
    "timezone": "Europe/Berlin",
    "locale": "de-DE",
    "dateFormat": "DD.MM.YYYY",
    "dateTimeFormat": "DD.MM.YYYY HH:mm",
    "inputDateFormat": "DD/MM/YYYY"
  }
}

UK locale with custom datetime:

{
  "templateSettings": {
    "timezone": "Europe/London",
    "locale": "en-GB",
    "dateFormat": "DD MMM YYYY",
    "dateTimeFormat": "DD MMM YYYY, HH:mm"
  }
}

US Central with 12-hour time:

{
  "templateSettings": {
    "timezone": "America/Chicago",
    "locale": "en-US",
    "dateFormat": "MMM D, YYYY",
    "dateTimeFormat": "MMM D, YYYY h:mm A"
  }
}

Number Formatting

Applied to all columns with format: "number" unless overridden per-column in a columnManifest.

PropertyTypeDefaultDescription
number.decimalPlacesnumber2 for fractions, 0 for integersHow many decimal places to display.
number.thousandsSeparatorstring","Character used to group thousands.
number.decimalSeparatorstring"."Character used as the decimal point.

European number style (period thousands, comma decimal):

{
  "templateSettings": {
    "number": {
      "decimalPlaces": 2,
      "thousandsSeparator": ".",
      "decimalSeparator": ","
    }
  }
}

Integer quantities, no decimals:

{
  "templateSettings": {
    "number": {
      "decimalPlaces": 0,
      "thousandsSeparator": ","
    }
  }
}

Currency Formatting

Applied to all columns with format: "currency" unless overridden per-column.

PropertyTypeDefaultDescription
currency.codestring"USD"ISO 4217 currency code used by Intl.NumberFormat (e.g. "EUR", "GBP", "JPY").
currency.symbolstringnoneOverride the rendered symbol (e.g. "€", "£"). Defaults to the symbol implied by code.
currency.position"before" | "after""before"Whether the symbol appears before or after the numeric value.
currency.decimalPlacesnumber2Number of decimal places.
currency.thousandsSeparatorstring","Thousands grouping character.
currency.decimalSeparatorstring"."Decimal point character.

US Dollars (default, explicit):

{
  "templateSettings": {
    "currency": {
      "code": "USD",
      "symbol": "$",
      "position": "before",
      "decimalPlaces": 2
    }
  }
}

Euros (symbol after amount):

{
  "templateSettings": {
    "currency": {
      "code": "EUR",
      "symbol": "€",
      "position": "after",
      "decimalPlaces": 2,
      "thousandsSeparator": ".",
      "decimalSeparator": ","
    }
  }
}

Japanese Yen (no decimals):

{
  "templateSettings": {
    "currency": {
      "code": "JPY",
      "symbol": "¥",
      "position": "before",
      "decimalPlaces": 0
    }
  }
}

Per-Column Overrides

Per-column overrides in a columnManifest always win over templateSettings.currency. Set currency at the template level for the document default, then override per-column only where needed.


Boolean Display

Applied to all columns with format: "boolean". Controls the text labels and optional icons rendered for truthy/falsy values.

PropertyTypeDefaultDescription
boolean.trueLabelstring"Yes"Text label rendered when the value is truthy.
boolean.falseLabelstring"No"Text label rendered when the value is falsy.
boolean.icons.truestringnoneIcon key prepended to the true label (e.g. "CheckCircle").
boolean.icons.falsestringnoneIcon key prepended to the false label (e.g. "XCircle").
boolean.icons.warningstringnoneIcon shown when the value cannot be classified (e.g. "AlertTriangle").

Yes/No with icons:

{
  "templateSettings": {
    "boolean": {
      "trueLabel": "Yes",
      "falseLabel": "No",
      "icons": {
        "true": "CheckCircle",
        "false": "XCircle"
      }
    }
  }
}

Active/Inactive (no icons):

{
  "templateSettings": {
    "boolean": {
      "trueLabel": "Active",
      "falseLabel": "Inactive"
    }
  }
}

Enabled / Disabled with warning state:

{
  "templateSettings": {
    "boolean": {
      "trueLabel": "Enabled",
      "falseLabel": "Disabled",
      "icons": {
        "true": "CheckCircle",
        "false": "XCircle",
        "warning": "AlertTriangle"
      }
    }
  }
}

Section Numbering

When sectionNumbering is true, every top-level section title is automatically prefixed with a sequential number (1., 2., 3., ...).

PropertyTypeDefaultDescription
sectionNumberingbooleanfalsePrefix section titles with sequential numbers.
{
  "templateSettings": {
    "sectionNumbering": true
  }
}

Rendered output:

1. Customer Information
2. Sales Orders
3. Payment Summary

Table of Contents (TOC)

When toc.enabled is true, a dedicated TOC page is generated and inserted at the start or end of the document. The TOC lists every section title with its page number and optional leader dots.

No Side Effects

When toc is absent or toc.enabled is false, no TOC page is generated and existing templates are completely unaffected.

TocSettings Properties

PropertyTypeDefaultDescription
toc.enabledbooleanfalseEnable TOC generation.
toc.position"start" | "end""start""start" inserts the TOC before the first content page. "end" appends it after all content.
toc.maxDepthnumber1Maximum section nesting depth included. 1 = top-level sections only.
toc.includeIconsbooleantrueShow section icons next to TOC entries (when the section has one configured).
toc.showPageNumbersbooleantrueDisplay page numbers right-aligned on each TOC entry.
toc.leaderDotsbooleantrueRender dotted leader lines between the section title and its page number.
toc.style"modern" | string"modern"Visual styling preset for the TOC page.
toc.excludeSectionsstring[][]Array of section node IDs or exact section titles to exclude from the TOC.

Per-Section Overrides

Individual sections can opt out of the TOC or provide a custom TOC label without changing the global settings:

PropertyTypeDefaultDescription
settings.excludeFromTOCbooleanfalseExclude this specific section from the TOC.
settings.tocLabelstringsection titleCustom label for this entry in the TOC. Falls back to the section's own title.

TOC at start of document:

{
  "templateSettings": {
    "toc": {
      "enabled": true,
      "position": "start",
      "includeIcons": true,
      "showPageNumbers": true,
      "leaderDots": true
    }
  }
}

TOC at end, top-level sections only:

{
  "templateSettings": {
    "toc": {
      "enabled": true,
      "position": "end",
      "maxDepth": 1,
      "showPageNumbers": true,
      "leaderDots": false
    }
  }
}

Exclude specific sections from TOC:

{
  "templateSettings": {
    "toc": {
      "enabled": true,
      "excludeSections": ["Appendix A", "Internal Notes"]
    }
  }
}

Per-section TOC override on a node:

{
  "type": "hierarchical_table",
  "title": "Patient Information",
  "settings": {
    "excludeFromTOC": false,
    "tocLabel": "Patient Info"
  }
}

Exclude a section node from TOC:

{
  "type": "section",
  "title": "Internal Notes",
  "settings": {
    "excludeFromTOC": true
  }
}

Watermark

Renders a text or SVG image watermark on every page of both the browser preview and server-generated PDFs.

No Side Effects

When watermark is absent or watermark.enabled is false, no watermark is applied and existing templates are completely unaffected.

Dynamic Watermark Text

You can inject dynamic watermark text at render time by setting a top-level watermarkText key in the JSON payload. This takes precedence over watermark.value.

{ "watermarkText": "DRAFT", "templateSettings": { } }

WatermarkSettings Properties

PropertyTypeDefaultDescription
watermark.enabledbooleanfalseMaster switch - must be true for any watermark to render.
watermark.type"text" | "image""text""text" renders value as diagonal text. "image" renders value as an inline SVG.
watermark.valuestringnoneWatermark content. Supports {{field}} payload tokens. For type: "text" use a plain string; for type: "image" use an SVG string.
watermark.opacitynumber0.1Opacity from 0.0 (invisible) to 1.0. Text watermarks are hard-capped at 0.2 for readability.
watermark.rotationnumber-45Rotation angle in degrees. Only applies to type: "text".
watermark.positionWatermarkPosition"center"Anchor position on each page (see values below).
watermark.fontSizenumber60Font size (pt) for text watermarks.
watermark.colorstring"#000000"Fill color for text watermarks. Hex string.

position values:

ValueDescription
"center"Centered horizontally and vertically on the page.
"top-center"Horizontally centered, near the top margin.
"bottom-center"Horizontally centered, near the bottom margin.
"top-left"Near the top-left corner.
"top-right"Near the top-right corner.
"bottom-left"Near the bottom-left corner.
"bottom-right"Near the bottom-right corner.

Standard "CONFIDENTIAL" diagonal watermark:

{
  "templateSettings": {
    "watermark": {
      "enabled": true,
      "type": "text",
      "value": "CONFIDENTIAL",
      "opacity": 0.1,
      "rotation": -45,
      "position": "center",
      "fontSize": 60,
      "color": "#000000"
    }
  }
}

"DRAFT" in red, larger font:

{
  "templateSettings": {
    "watermark": {
      "enabled": true,
      "type": "text",
      "value": "DRAFT",
      "opacity": 0.15,
      "rotation": -30,
      "position": "center",
      "fontSize": 80,
      "color": "#DC2626"
    }
  }
}

Dynamic watermark from payload:

{
  "templateSettings": {
    "watermark": {
      "enabled": true,
      "type": "text",
      "value": "{{status}}",
      "opacity": 0.1,
      "rotation": -45,
      "position": "center"
    }
  },
  "status": "DRAFT"
}

Bottom-right corner stamp:

{
  "templateSettings": {
    "watermark": {
      "enabled": true,
      "type": "text",
      "value": "INTERNAL USE ONLY",
      "opacity": 0.18,
      "rotation": 0,
      "position": "bottom-right",
      "fontSize": 14,
      "color": "#6B7280"
    }
  }
}

Top-right corner, no rotation:

{
  "templateSettings": {
    "watermark": {
      "enabled": true,
      "type": "text",
      "value": "COPY",
      "opacity": 0.2,
      "rotation": 0,
      "position": "top-right",
      "fontSize": 20,
      "color": "#1E40AF"
    }
  }
}

Security

Server-Side Only (Future)

Security / password-protection is reserved for future server-side implementation. These settings are parsed and validated but no password logic is applied in browser rendering.

PropertyTypeDefaultDescription
security.enabledbooleanfalseEnable security features. No-op in browser rendering.
security.requireJsonPasswordbooleanfalseRequire the PDF to be opened with a password supplied in the JSON payload. Server-side only (future).
security.defaultPasswordstringnoneFallback password when requireJsonPassword is false or no per-request password is provided. Server-side only (future).
security.validatePasswordbooleanfalseEnforce password complexity rules on server-side rendering. Server-side only (future).
{
  "templateSettings": {
    "security": {
      "enabled": true,
      "requireJsonPassword": true
    }
  }
}

Distribution

Controls how the renderer outputs documents when the payload contains a batch array (multiple records). When distribution.enabled is true and mode is "individual", the server generates one PDF file per batch item and uses fileNameTemplate to name each file. When mode is "combined" (or distribution is absent/disabled), all batch items are merged into a single PDF with page breaks between them.

Server-Side Only

distribution is a server-side setting. In browser preview mode all batch items are always combined into one PDF regardless of this setting.

PropertyTypeDefaultDescription
distribution.enabledbooleanfalseEnable per-item file splitting on the server.
distribution.mode"individual" | "combined""individual""individual" - one file per batch item. "combined" - all items in one PDF.
distribution.fileNameTemplatestring"Doc_{BATCHID}"File name pattern for each output file. Supports {BATCHID} (0-based index) and any {{field}} payload token.

fileNameTemplate tokens:

TokenResolves to
{BATCHID}Zero-based index of the batch item (0, 1, 2, ...).
{{field}}Any top-level field from the item's data record (e.g. {{orderId}}, {{customerName}}).

One PDF per customer:

{
  "templateSettings": {
    "distribution": {
      "enabled": true,
      "mode": "individual",
      "fileNameTemplate": "Invoice_{{invoiceNumber}}"
    }
  }
}

Single combined PDF (disabled):

{
  "templateSettings": {
    "distribution": {
      "enabled": false,
      "mode": "combined"
    }
  }
}

Approval Panel

When approvalPanel.enabled is true, an Approval & Verification page is automatically appended to every rendered document. The page displays a signature grid (populated from data.signatures or data.documentAttestation.signatures), an optional digital thumbprint, and an optional QR code linking to a verification URL. For full details on how signature data is structured and how the approval page integrates with e-signature platforms, see Signature Zones.

Per-Request Overrides

The approvalPanel settings act as document-level defaults. Any individual field (e.g. headingLabel, verificationUrl) can also be overridden per-request by setting the same key directly on the data payload or inside documentAttestation.

PropertyTypeDefaultDescription
approvalPanel.enabledbooleanfalseAppend an approval page to the document.
approvalPanel.columns1 | 2 | 32Number of signature columns in the approval grid.
approvalPanel.includeDigitalThumbprintbooleanfalseAppend a deterministic 4-segment hex fingerprint derived from document metadata and approver names. Not a cryptographic hash - a lightweight integrity marker.
approvalPanel.headingLabelstring"Approval & Verification"Custom heading displayed at the top of the approval page.
approvalPanel.headingAlignment"left" | "center" | "right""left"Alignment of the heading text.
approvalPanel.headingFontSizenumber14Font size (pt) for the heading.
approvalPanel.userstringnoneName or identifier of the requesting user, displayed in the document metadata area of the approval page. Supports {{field}} payload tokens.
approvalPanel.verificationUrlstringnoneURL embedded as a QR code on the approval page. Rendered alongside a "Scan to verify" label. Supports {{field}} payload tokens.

Minimal approval page (signature grid only):

{
  "templateSettings": {
    "approvalPanel": {
      "enabled": true,
      "columns": 2
    }
  }
}

Full approval page with thumbprint and QR:

{
  "templateSettings": {
    "approvalPanel": {
      "enabled": true,
      "columns": 2,
      "includeDigitalThumbprint": true,
      "headingLabel": "Document Approval & Verification",
      "headingAlignment": "center",
      "headingFontSize": 22,
      "user": "{{user}}",
      "verificationUrl": "www.vaultpdf.io"
    }
  }
}

Three-column layout, dynamic verification URL:

{
  "templateSettings": {
    "approvalPanel": {
      "enabled": true,
      "columns": 3,
      "includeDigitalThumbprint": true,
      "headingLabel": "Signoff Required",
      "headingAlignment": "left",
      "verificationUrl": "https://portal.example.com/verify/{{documentId}}"
    }
  }
}

Signatures Required

The approval page requires at least one entry in data.signatures (or data.documentAttestation.signatures) to render. If the signatures object is absent or empty, the approval page is silently omitted even when enabled is true.


Full Example

Complete templateSettings block combining all features. Omit any section you don't need - defaults are applied automatically.

{
  "templateSettings": {
    "timezone": "America/Chicago",
    "locale": "en-US",
    "dateFormat": "MMM D, YYYY",
    "dateTimeFormat": "MMM D, YYYY h:mm A",
    "inputDateFormat": "MM/DD/YYYY",

    "currency": {
      "code": "USD",
      "symbol": "$",
      "position": "before",
      "decimalPlaces": 2,
      "thousandsSeparator": ",",
      "decimalSeparator": "."
    },

    "number": {
      "decimalPlaces": 2,
      "thousandsSeparator": ",",
      "decimalSeparator": "."
    },

    "boolean": {
      "trueLabel": "Yes",
      "falseLabel": "No",
      "icons": {
        "true": "CheckCircle",
        "false": "XCircle",
        "warning": "AlertTriangle"
      }
    },

    "sectionNumbering": true,

    "toc": {
      "enabled": true,
      "position": "start",
      "maxDepth": 1,
      "includeIcons": true,
      "showPageNumbers": true,
      "leaderDots": true,
      "style": "modern",
      "excludeSections": []
    },

    "watermark": {
      "enabled": false,
      "type": "text",
      "value": "CONFIDENTIAL",
      "opacity": 0.1,
      "rotation": -45,
      "position": "center",
      "fontSize": 60,
      "color": "#000000"
    },

    "security": {
      "enabled": false
    },

    "distribution": {
      "enabled": false,
      "mode": "individual",
      "fileNameTemplate": "Doc_{BATCHID}"
    },

    "approvalPanel": {
      "enabled": true,
      "columns": 2,
      "includeDigitalThumbprint": true,
      "headingLabel": "Document Approval & Verification",
      "headingAlignment": "center",
      "headingFontSize": 22,
      "user": "{{user}}",
      "verificationUrl": "www.vaultpdf.io"
    }
  }
}

On this page