# Headers, footers and page numbers

Choose Off, Inherit or Customize for each page’s Header and Footer, preserve custom content, and add automatic page numbers.

A document title at the top, contact details at the bottom, or a “1 / 3” page label can all live in **Header** and **Footer**. Write the content once, and Tembuilder repeats it on the PDF sheets where that part is enabled.

Global provides the shared Header and Footer. Each page independently chooses **Off**, **Inherit**, or **Customize** for each part. Customized content belongs to that page and repeats on its physical PDF sheets.

## 1. Add a Header or Footer

Expand **Global** in **Structure**, then select **Add global element → Header** or **Footer**. If it already exists, select it directly in the list to edit it.

The toggle beside each Global item controls visibility for pages using **Inherit**. Turning it off preserves the shared content. Pages using **Customize** keep their own Header or Footer enabled.

Adding a new Header or Footer is available in the base variant. Switch back to the base if you are editing another variant and do not see Add global element.

<figure class="doc-sim hf-illustration" aria-label="Structure → Global → Add global element → Header or Footer">
<div class="sim-stage"><div class="hf-add-scene"><div class="sim-panel hf-tree"><div class="sim-panel-title">STRUCTURE</div><div class="sim-tree-row">⌄ Global <small>1/2</small></div><div class="hf-tree-item">▤ Footer <span class="hf-toggle" aria-label="On"></span></div><div class="hf-add-row"><span class="sim-control sim-focus">＋ Add global element</span><div class="hf-menu">▤ Header</div></div></div><div class="hf-repeat"><small>Header / Footer</small><div class="hf-paper"><div class="hf-paper-header">Tembuilder <small>INVOICE</small></div><div class="hf-paper-body"><strong>INVOICE</strong><span>TB-2026-0042</span><i></i><i></i><i></i></div><div class="hf-paper-footer"><span>tembuilder.com</span><b>1 / 3</b></div></div></div></div></div>
<figcaption>Structure → Global → Add global element → Header or Footer</figcaption>
</figure>

## 2. Edit the repeated content

Select **Header** or **Footer** to open its **HTML**, **CSS**, **Props**, and **Config** tabs.

With an existing template, start in **Props** to update a company name, website, or label used by that template. For example, the invoice template has a `footerWebsite` prop for the website shown at the bottom of the page.

Use **HTML** to change content or structure, and **CSS** to change its presentation. In Header/Footer HTML, `{{ props.propName }}` reads a prop belonging to that part; `{{ global.props.propName }}` reads a prop from Global.

<figure class="doc-sim hf-illustration" aria-label="Global → Footer → Props → footerWebsite">
<div class="sim-stage"><div class="hf-path">Global <span>→</span> Footer <span>→</span> Props</div><div class="sim-panel"><div class="sim-tabs"><span>HTML</span><span>CSS</span><span class="sim-active">Props</span><span>Config</span></div><div class="hf-prop"><small class="sim-label">FOOTER</small><div class="sim-prop-card"><div class="sim-prop-name"><b>footerWebsite</b><small>Text</small></div><div class="sim-prop-value"><small class="sim-label">VALUE</small><span class="sim-input sim-focus">tembuilder.com</span><span class="sim-embed">{{ props.footerWebsite }}</span></div></div></div><div class="hf-footer-preview"><b>Tembuilder</b><span>tembuilder.com</span><small>1 / 3</small></div></div></div>
<figcaption>Global → Footer → Props → footerWebsite</figcaption>
</figure>

## 3. Set Header and Footer margins

Open **Header → Config → Margin** or **Footer → Config → Margin**. Enable margins and enter the four sides in **mm**. The **Background** section below sets the background of that Header or Footer.

These margins are separate from **Content margin**. To align a header logo with a table in the body, set the Header’s Left/Right margins to match the content area’s Left/Right margins.

Header/Footer height follows its content, including its own margins. **Content margin → Top/Bottom** provides the gap between that area and the main content. To increase the gap after a Header, change Content margin Top; to inset a logo inside the Header, change the Header’s margins or CSS.

<figure class="doc-sim hf-illustration" aria-label="Header/Footer margins and Content margin are separate settings">
<div class="sim-stage"><div class="hf-path">Global <span>→</span> Header <span>→</span> Config</div><div class="hf-margin-scene"><div class="sim-panel"><div class="sim-tabs"><span>Props</span><span class="sim-active">Config</span></div><div class="hf-margin-card"><div class="hf-setting"><strong>Margin · mm</strong><span class="hf-toggle" aria-label="On"></span></div><div class="hf-setting"><span>Top</span><span class="sim-input">4</span></div><div class="hf-setting"><span>Left</span><span class="sim-input sim-focus">14</span></div><div class="hf-setting"><span>Right</span><span class="sim-input">14</span></div><div class="hf-setting"><span>Bottom</span><span class="sim-input">4</span></div></div></div><div class="hf-band-page"><div class="hf-band-header">Header<small>Margin</small></div><div class="hf-band-gap">Content margin · Top</div><div class="hf-band-content">Section content<i></i><i></i><i></i></div><div class="hf-band-footer">Footer</div></div></div></div>
<figcaption>Header/Footer margins and Content margin are separate settings</figcaption>
</figure>

## 4. Choose a mode for each page

Select a page in **Structure → Config → Layout**. Header and Footer each have their own mode.

| Mode | On the page | In Structure |
| --- | --- | --- |
| **Off** | Hides this part. | Hides its page item. |
| **Inherit** | Uses the current Global version and follows its visibility. | Hides its page item. |
| **Customize** | Uses this page’s saved copy, including when the Global part is off. | Shows its page item. |

For a cover, choose **Off** for Header and Footer. Choose **Inherit** on pages that should follow the shared design. Use **Customize** when a page needs its own repeated content or configuration.

<figure class="doc-sim hf-illustration" aria-label="Each page chooses its Header and Footer mode">
<div class="sim-stage"><div class="hf-path">Structure <span>→</span> Page <span>→</span> Config</div><div class="sim-panel hf-mode-card"><div class="sim-panel-title">Layout</div><div class="hf-setting"><span>Header</span><div class="sim-tabs"><span>Off</span><span>Inherit</span><span class="sim-active">Customize</span></div></div><div class="hf-setting"><span>Footer</span><div class="sim-tabs"><span>Off</span><span class="sim-active">Inherit</span><span>Customize</span></div></div></div></div>
<figcaption>Each page chooses its Header and Footer mode</figcaption>
</figure>

## 5. Insert automatic page numbers

Add this to Footer or Header HTML:

```handlebars
<span>{{ global.props.page_number }} / {{ global.props.total_pages }}</span>
```

These values are built into **Global Props** and filled by the system when the document is generated:

| Value | Content |
| --- | --- |
| `global.props.page_number` | The current PDF sheet number. |
| `global.props.total_pages` | The total PDF sheet count. |

You do not need to create another prop to store page numbers. For a three-sheet document, this example displays `1 / 3`, `2 / 3`, and `3 / 3`.

> [!NOTE] Information
>
> Numbers refer to **PDF sheets**, not the number of pages in Structure. One Structure page can produce several sheets, each with its own number. Hiding Header/Footer on a cover does not exclude that sheet from the total count.

<figure class="doc-sim hf-illustration" aria-label="System values show the current PDF sheet and total sheet count">
<div class="sim-stage"><div class="hf-path">Global <span>→</span> Footer <span>→</span> HTML</div><div class="sim-panel"><div class="sim-tabs"><span class="sim-active">HTML</span><span>CSS</span><span>Props</span><span>Config</span></div><div class="hf-number-source sim-focus"><code>{{ global.props.page_number }} /<br />{{ global.props.total_pages }}</code></div><div class="hf-number-pages"><div class="hf-paper"><div class="hf-paper-header">Tembuilder <small>INVOICE</small></div><div class="hf-paper-body"><strong>INVOICE</strong><span>TB-2026-0042</span><i></i><i></i><i></i></div><div class="hf-paper-footer"><span>tembuilder.com</span><b>1 / 3</b></div></div><div class="hf-paper"><div class="hf-paper-header">Tembuilder <small>INVOICE</small></div><div class="hf-paper-body"><strong>INVOICE</strong><span>TB-2026-0042</span><i></i><i></i><i></i></div><div class="hf-paper-footer"><span>tembuilder.com</span><b>2 / 3</b></div></div><div class="hf-paper"><div class="hf-paper-header">Tembuilder <small>INVOICE</small></div><div class="hf-paper-body"><strong>INVOICE</strong><span>TB-2026-0042</span><i></i><i></i><i></i></div><div class="hf-paper-footer"><span>tembuilder.com</span><b>3 / 3</b></div></div></div></div></div>
<figcaption>System values show the current PDF sheet and total sheet count</figcaption>
</figure>

## 6. Customize a page’s Header or Footer

The first switch to **Customize** copies the effective Global HTML, CSS, props and configuration, including margins, mirroring and background. If no Global content exists, you start with an empty editable copy.

Expand the page in Structure. Its customized items appear before the content sections, ordered **Header → Footer → sections**. Select an item to edit its own **HTML**, **CSS**, **Props** or **Config** tab. Changes to this copy belong to the page. Later Global changes apply to pages using Inherit.

Switching to **Off** or **Inherit** keeps the customized copy and hides its item. Returning to **Customize** restores your edits, including after saving and reopening the template.

Each customized Header or Footer repeats across all PDF sheets produced by its logical page. In a variant, use the page’s **Follow Base / Customize** control to choose whether that variant owns the configuration. This is separate from the Header/Footer mode. Editing a page-owned copy in another variant creates an independent copy for that variant.
