---
title: "text.extract: Extract text — PDF kit command — Kition"
description: "Extract the text of some or all pages, in reading order. With rect, only the text inside that rectangle on each page, as Column select takes it: one row per visual line, side-by-side pieces (table cells) separated by a tab."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/text.extract"
---

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

# text.extract

**Extract text.** Extract the text of some or all pages, in reading order. With rect, only the text inside that rectangle on each page, as Column select takes it: one row per visual line, side-by-side pieces (table cells) separated by a tab.

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

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `pages` | `integer[]` | no | 1-based page numbers to extract (default: all). (minItems 1) |
| `rect` | `number[]` | no | Column select: [x0, y0, x1, y1] in points from the top-left of the displayed page; a glyph counts when its centre is inside. (maxItems 4, minItems 4) |

## Call through pdf_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `pages`, `rect`. pdf_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `pages` | `object[]` | no |  |

```json
{
  "additionalProperties": true,
  "properties": {
    "pages": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "page": {
            "type": "number"
          },
          "text": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "pages": {
      "description": "1-based page numbers to extract (default: all). (minItems 1)",
      "items": {
        "description": "(minimum 1)",
        "type": "integer"
      },
      "type": "array"
    },
    "rect": {
      "description": "Column select: [x0, y0, x1, y1] in points from the top-left of the displayed page; a glyph counts when its centre is inside. (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).
