> ## Documentation Index
> Fetch the complete documentation index at: https://developer.kodexa.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract Document Text

> Use kdx document text to extract readable text from KDDB documents page by page with markers, with options for page range and node-specific extraction.

Output the full readable text content of a KDDB document, page by page with markers. Supports page range filtering and node-specific text extraction.

## Usage

```bash theme={null}
kdx document text <file.kddb> [flags]
```

## Flags

| Flag                | Description                               | Default   |
| ------------------- | ----------------------------------------- | --------- |
| `--pages start:end` | Page range (1-based, inclusive)           | All pages |
| `--node-id N`       | Extract text from a specific node subtree |           |

## Examples

### Full Document Text

```bash theme={null}
kdx document text report.kddb
```

```text theme={null}
--- Page 1 ---
ANNUAL REPORT
Fiscal Year 2024
Prepared by Finance Department

--- Page 2 ---
Table of Contents
Executive Summary .......... 3
Financial Overview ......... 5
```

### Page Range

```bash theme={null}
kdx document text report.kddb --pages 5:10
```

### Node Subtree Text

```bash theme={null}
kdx document text report.kddb --node-id 42
```

<Tip>
  Use `--pages` to extract specific sections without reading the entire document. Combine with shell tools like `wc -w` to count words per page.
</Tip>
