---
title: "page.setBox: Set page boxes / crop — PDF kit command — Kition"
description: "Set a page box (crop by default; also trim, bleed, art, media) on pages: either margins in points from the media box [left, bottom, right, top], or an absolute rect in points from the top-left of the displayed page. Omit both to reset the box to its default. Undoable."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/page.setBox"
---

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

# page.setBox

**Set page boxes / crop.** Set a page box (crop by default; also trim, bleed, art, media) on pages: either margins in points from the media box [left, bottom, right, top], or an absolute rect in points from the top-left of the displayed page. Omit both to reset the box to its default. 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 |
| --- | --- | --- | --- |
| `box` | `"crop" \| "trim" \| "bleed" \| "art" \| "media"` | no |  |
| `margins` | `number[]` | no | (maxItems 4, minItems 4) |
| `pages` | `integer[]` | no | 1-based page numbers to change (default: all). (minItems 1) |
| `rect` | `number[]` | no | (maxItems 4, minItems 4) |

## Call through pdf_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `box`, `margins`, `pages`, `rect`. 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": {
    "box": {
      "enum": [
        "crop",
        "trim",
        "bleed",
        "art",
        "media"
      ],
      "type": "string"
    },
    "margins": {
      "description": "(maxItems 4, minItems 4)",
      "items": {
        "description": "(minimum 0)",
        "type": "number"
      },
      "type": "array"
    },
    "pages": {
      "description": "1-based page numbers to change (default: all). (minItems 1)",
      "items": {
        "description": "(minimum 1)",
        "type": "integer"
      },
      "type": "array"
    },
    "rect": {
      "description": "(maxItems 4, minItems 4)",
      "items": {
        "type": "number"
      },
      "type": "array"
    }
  },
  "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).
