---
title: "file.setHeaderFooter: Add header and footer — PDF kit command — Kition"
description: "Add a header and/or footer to pages. Text boxes: headerLeft/headerCenter/headerRight, footerLeft/footerCenter/footerRight. Tokens: <<1>> page number, <<n>> page count, <<1 of n>>, <<Page 1 of n>>, <<1/n>>, dates <<m/d/yyyy>> <<yyyy-mm-dd>> <<mmmm d, yyyy>> (and more), Bates <<Bates Number#6#1#PREFIX#SUFFIX>>. replace: true swaps out existing ones (Update). Undoable."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/file.setHeaderFooter"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/pdf/commands/file.setHeaderFooter](https://developer.kition.ai/docs/kits/pdf/commands/file.setHeaderFooter)

# file.setHeaderFooter

**Add header and footer.** Add a header and/or footer to pages. Text boxes: headerLeft/headerCenter/headerRight, footerLeft/footerCenter/footerRight. Tokens: <<1>> page number, <<n>> page count, <<1 of n>>, <<Page 1 of n>>, <<1/n>>, dates <<m/d/yyyy>> <<yyyy-mm-dd>> <<mmmm d, yyyy>> (and more), Bates <<Bates Number#6#1#PREFIX#SUFFIX>>. replace: true swaps out existing ones (Update). Undoable.

- Kit: PDF 0.1.0 (.pdf); reference: [PDF kit commands](https://developer.kition.ai/docs/kits/pdf.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `color` | `string` | no | #RRGGBB or a colour name. |
| `fontSize` | `number` | no |  |
| `footerCenter` | `string` | no |  |
| `footerLeft` | `string` | no |  |
| `footerRight` | `string` | no |  |
| `headerCenter` | `string` | no |  |
| `headerLeft` | `string` | no |  |
| `headerRight` | `string` | no |  |
| `margins` | `number[]` | no | Top, bottom, left, right in points (default 36, 36, 72, 72). (maxItems 4, minItems 4) |
| `pages` | `integer[]` | no | 1-based page numbers to mark (default: all). (minItems 1) |
| `replace` | `boolean` | no |  |
| `startNumber` | `integer` | no | (minimum 1) |

## Call through pdf_run

```text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "file.setHeaderFooter" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `color`, `fontSize`, `footerCenter`, `footerLeft`, `footerRight`, `headerCenter`, `headerLeft`, `headerRight`, `margins`, `pages`, `replace`, `startNumber`. pdf_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "color": {
      "description": "#RRGGBB or a colour name.",
      "type": "string"
    },
    "fontSize": {
      "type": "number"
    },
    "footerCenter": {
      "type": "string"
    },
    "footerLeft": {
      "type": "string"
    },
    "footerRight": {
      "type": "string"
    },
    "headerCenter": {
      "type": "string"
    },
    "headerLeft": {
      "type": "string"
    },
    "headerRight": {
      "type": "string"
    },
    "margins": {
      "description": "Top, bottom, left, right in points (default 36, 36, 72, 72). (maxItems 4, minItems 4)",
      "items": {
        "description": "(minimum 0)",
        "type": "number"
      },
      "type": "array"
    },
    "pages": {
      "description": "1-based page numbers to mark (default: all). (minItems 1)",
      "items": {
        "description": "(minimum 1)",
        "type": "integer"
      },
      "type": "array"
    },
    "replace": {
      "type": "boolean"
    },
    "startNumber": {
      "description": "(minimum 1)",
      "type": "integer"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/pdf-darwin-arm64@0.1.0 and the kit itself (pdf_commands through @kition/cli@0.1.1, built from KitionAI/kition-pdf@b0d2725).
