---
title: "file.setBackground: Add background — PDF kit command — Kition"
description: "Fill page backgrounds with a colour, or a picture from `file` (an image, or page `filePage` of a PDF) fitted at `scale` (default 1), behind the content. Undoable."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/file.setBackground"
---

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

# file.setBackground

**Add background.** Fill page backgrounds with a colour, or a picture from `file` (an image, or page `filePage` of a PDF) fitted at `scale` (default 1), behind the content. 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 |  |
| `filePage` | `integer` | no | (minimum 1) |
| `opacity` | `number` | no | (maximum 1, minimum 0) |
| `pages` | `integer[]` | no | 1-based page numbers to fill (default: all). (minItems 1) |
| `replace` | `boolean` | no |  |
| `scale` | `number` | no | (maximum 1) |

## Call through pdf_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `color`, `filePage`, `opacity`, `pages`, `replace`, `scale`. 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": {
      "type": "string"
    },
    "filePage": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "opacity": {
      "description": "(maximum 1, minimum 0)",
      "type": "number"
    },
    "pages": {
      "description": "1-based page numbers to fill (default: all). (minItems 1)",
      "items": {
        "description": "(minimum 1)",
        "type": "integer"
      },
      "type": "array"
    },
    "replace": {
      "type": "boolean"
    },
    "scale": {
      "description": "(maximum 1)",
      "type": "number"
    }
  },
  "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).
