---
title: "text.find: Find text — PDF kit command — Kition"
description: "Find a phrase (whitespace-normalised; case-insensitive unless caseSensitive) and return each match with its page and line rectangles in points (origin top-left). With wholeWords, a match may not touch a letter or digit on either side."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/text.find"
---

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

# text.find

**Find text.** Find a phrase (whitespace-normalised; case-insensitive unless caseSensitive) and return each match with its page and line rectangles in points (origin top-left). With wholeWords, a match may not touch a letter or digit on either side.

- 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 |
| --- | --- | --- | --- |
| `caseSensitive` | `boolean` | no | Match upper and lower case as written. |
| `context` | `integer` | no | With each match, up to this many characters of the page's text before it (before) and after it (after), for a list of results. (maximum 80, minimum 0) |
| `limit` | `integer` | no | Maximum matches (default 500). (minimum 1) |
| `query` | `string` | yes | (minLength 1) |
| `wholeWords` | `boolean` | no | Only matches with no letter or digit right before or after them (in Chinese, Japanese and Thai, which have no spaces between words, any character boundary counts). |

## Call through pdf_run

```text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "text.find", "params": { "query": <string> } }]
}
```

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

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `count` | `number` | no |  |
| `matches` | `any[]` | no |  |
| `query` | `string` | no |  |

```json
{
  "additionalProperties": true,
  "properties": {
    "count": {
      "type": "number"
    },
    "matches": {
      "type": "array"
    },
    "query": {
      "type": "string"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "caseSensitive": {
      "default": false,
      "description": "Match upper and lower case as written.",
      "type": "boolean"
    },
    "context": {
      "description": "With each match, up to this many characters of the page's text before it (before) and after it (after), for a list of results. (maximum 80, minimum 0)",
      "type": "integer"
    },
    "limit": {
      "description": "Maximum matches (default 500). (minimum 1)",
      "type": "integer"
    },
    "query": {
      "description": "(minLength 1)",
      "type": "string"
    },
    "wholeWords": {
      "default": false,
      "description": "Only matches with no letter or digit right before or after them (in Chinese, Japanese and Thai, which have no spaces between words, any character boundary counts).",
      "type": "boolean"
    }
  },
  "required": [
    "query"
  ],
  "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).
