Skip to main content

Globals

Built-in $global.NAME tokens for date, time, page numbers, and document metadata. They resolve in the document's text and in the display text around it: the metadata, bookmark titles, a signature's reason and location and an attachment's description (Where they resolve). The page-related tokens resolve only in headers, footers and watermarks.

{ "p": "Generated $global.DATE by $global.AUTHOR" }

Date and time​

TokenOutput
$global.DATE2026-05-02
$global.DATE.YEAR2026
$global.DATE.MONTH05
$global.DATE.MONTHNAMEMay
$global.DATE.MONTHSHORTMay
$global.DATE.DAY02
$global.DATE.WEEKDAYSaturday
$global.DATE.WEEKDAYSHORTSat
$global.TIME14:30:45
$global.TIME.HOUR14
$global.TIME.MINUTE30
$global.TIME.SECOND45
$global.CREATEDATESame set of subfields as DATE

All values in English, 24-hour time, locale-independent.

The clock is UTC, read once per render, so every date and time token in a document names the same instant. CREATEDATE is that same instant: the document's creation moment is its render. To print a fixed date (a contract's effective date, an invoice date), bind it as your own $data value; $global.DATE always reads the clock.

Document metadata​

TokenSource
$global.AUTHORmetadata.author
$global.TITLEmetadata.title
$global.SUBJECTmetadata.subject
$global.KEYWORDSmetadata.keywords
$global.VERSIONmetadata.version, the revision a component is pinned by

Missing metadata fields resolve to an empty string.

$global tokens also resolve inside the metadata's title, author, subject and keywords. The clock resolves there first, so $global.TITLE names the title a reader will see:

{
"document": {
"metadata": {
"title": "Annual report $global.DATE.YEAR",
"subject": "Summary of $global.TITLE"
},
"content": [{ "h1": "$global.TITLE" }]
}
}

A page token in the metadata never becomes a number, since the metadata is on no page; it is drawn as written and reported.

Page numbers​

TokenOutputSupported in
$global.PAGECurrent page numberHeader, footer, watermark
$global.NUMPAGESTotal page countHeader, footer, watermark
$global.SECTIONCurrent section numberHeader, footer, watermark
Header, footer and watermark only

These resolve per page, so only in content drawn on every page: a header, a footer or a watermark. In the body, which is laid out once, they are drawn as written and the render report names them. To print the page a block lands on, anywhere, use $global.PAGEREF.<id>.

{
"footer": {
"content": [
{ "p": "Page $global.PAGE of $global.NUMPAGES" }
]
}
}

$global.PAGE prints the number the page shows, which is its position until a section restarts the count. A pageSetup.pageNumbering with a start and a format (lowerRoman, upperRoman, decimal, ...) restarts it, so front matter numbered i, ii and a body that starts again at 1 print exactly those folios, and the PDF's page labels say the same. $global.SECTION counts the sections, one more at each break: "section".

In the DOCX, PAGE, NUMPAGES and SECTION in a header or footer are written as Word fields, which Word computes on each page; the numbering restarts become the section's own page numbering.

Running heads: $global.STYLEREF.<style>​

$global.STYLEREF.chapter is the text of the first block styled chapter that begins on the page, or, on a page where none begins, of the last one before it: a chapter title heads every page of its chapter, and a page where two chapters meet is headed by the one it opens with. Like the page numbers, it resolves in a header, a footer or a watermark. A block counts on the page it lands on wherever it stands: a heading in a flow of columns, a grid or a table cell that opens a page heads that page.

{
"document": {
"styles": { "chapter": { "fontSize": 16, "fontWeight": "bold" } },
"header": {
"content": [{ "p": "$global.STYLEREF.chapter | page $global.PAGE" }]
},
"content": [
{ "p": "Introduction", "style": "chapter" },
{ "p": "First chapter text." },
{ "break": "page" },
{ "p": "Methods", "style": "chapter" },
{ "p": "Second chapter text." }
]
}
}

The first page is headed "Introduction", the second "Methods". Before the first block of that style the head is empty; a style no block wears is a misspelt name, left standing and reported. The DOCX does not carry it: the document's styles are not Word styles for Word's own STYLEREF field to name, so the head is omitted and the report says so.

Page references: $global.PAGEREF.<id>​

$global.PAGEREF.leave prints the number of the page the block with "id": "leave" lands on: a cross-reference that stays right when content moves. Unlike the page numbers above, it resolves everywhere content is laid, the body included, since its value is the same on every page.

{
"document": {
"content": [
{ "p": "Leave is set out on page $global.PAGEREF.leave." },
{ "p": "See [goto, leave]the leave rules on page $global.PAGEREF.leave[/goto]." },
{ "h2": "Leave", "id": "leave" }
]
}
}
  • It prints the number the page shows, as a table of contents does: front matter numbered i, ii prints roman numerals.
  • Wrapped in a [goto], the number is also a link to the block.
  • An id is any run of characters without a space, so the token takes the longest id the document declares: a full stop ending the sentence stays text, and an id such as v1.2 is read whole.
  • An id no block carries is reported, naming the ids nearest to it.
  • In the DOCX it is a Word page-reference field to the bookmark the id becomes, which Word computes when it opens the file.

Where they resolve​

Where$global
Content: paragraphs, headings, cells, list items, svg text, headers, footers, watermarksyes (page numbers and running heads only in headers, footers and watermarks; PAGEREF everywhere)
metadata: title, author, subject, keywordsyes
outlines: each entry's titleyes
signature.appearance: reason, locationyes
attachments: descriptionyes
signature.appearance: signedBy, signDateno: these are claims the signature makes. Use showSigner and showSignDate, which take them from the signing itself, or bind them with $data
attachments: fileNameno: the name is the file's key inside the document, the same on every render. Name it, or bind it with $data

A token where it does not resolve is drawn as written and the render report names it, with the reason.

Notes​

  • Trailing period is sentence punctuation: $global.NUMPAGES. → 12.
  • Unknown tokens (typos) are kept verbatim so the mistake is visible, and the render report names them.
  • Shortcodes wrap globals normally: [b]$global.AUTHOR[/b], [caps]$global.DATE.MONTHNAME[/caps].