Headers & Footers
The header and footer objects define content that repeats on every page of the document. Both support text content with page-number tokens, visual separators, and the ability to skip specific pages.
Properties
| Property | Type | Description |
|---|---|---|
content | array | Array of content elements (paragraphs with inline formatting, canvas, columns, …) |
separator | object | Horizontal line separating header/footer from body content |
skipPages | number[] | Array of 1-based page numbers where this header/footer should not appear |
offset | number | Padding in points between the zone and the content that precedes it (default 8) |
Content
The content array works the same as the document's main content array. Each element supports $data resolution and inline formatting tags such as [b], [fontcolor], [tab], [image].
{
"header": {
"content": [
{ "p": "ShipForge[tab, 400, 0]Quarterly Report", "style": "headerStyle" }
]
}
}
Page numbers
Page numbering uses the global tokens $global.PAGE and $global.NUMPAGES, resolved at render time inside any header or footer paragraph. See Globals for the full list.
{
"footer": {
"content": [
{ "p": "Page [b]$global.PAGE[/b] of $global.NUMPAGES", "style": "footerStyle" }
]
}
}
Inline tags work inside the page-number paragraph just like any other content.
Separator
The separator property draws a horizontal line between the header/footer area and the page body. It uses the same line definition as the standalone separator element.
| Property | Type | Description |
|---|---|---|
lineType | string | SOLID, DASHED, or DOTTED |
color | string | Line color as hex string |
width | number | Line thickness in points |
length | number | Line length in points |
{
"separator": {
"lineType": "SOLID",
"length": 500,
"width": 0.5,
"color": "#CCCCCC"
}
}
Skip pages
Use skipPages to suppress a header or footer on specific pages. Page numbers are 1-based — commonly used to hide the header on a title page.
{
"header": {
"content": [ ... ],
"skipPages": [1]
}
}
Complete example
{
"header": {
"content": [
{ "p": "ShipForge[tab, 400, 0]Quarterly Report", "style": "headerStyle" }
],
"separator": { "lineType": "SOLID", "width": 0.5, "color": "#CCCCCC", "length": 500 },
"skipPages": [1]
},
"footer": {
"content": [
{ "p": "[fontcolor, #CC0000]CONFIDENTIAL[/fontcolor]", "style": "footerStyle" },
{ "p": "Page [b]$global.PAGE[/b] of $global.NUMPAGES", "style": "footerStyle" }
],
"separator": { "lineType": "DASHED", "width": 0.4, "color": "#999999", "length": 500 }
}
}
In this example:
- The header displays the company name on the right via
[tab], separated from the body by a solid line, and is hidden on the first page (title page). - The footer shows a red "CONFIDENTIAL" notice, a dashed separator, and a page-number line with
[b]…[/b]bolding around the current page number.