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

# Command line

The package has a `docx` command.

```sh theme={null}
npx docx pdf  input.docx -o output.pdf
npx docx png  input.docx -o pages/ --pages 1-3 --scale 2
npx docx json input.docx -o layout.json
```

## Commands

| Command | Does |
| - | - |
| `docx pdf <file>` | Writes a PDF |
| `docx png <file>` | Writes one PNG for each page into a folder |
| `docx json <file>` | Writes the layout IR (pages, lines, runs, boxes) as JSON |
| `docx blocks <file>` | Writes semantic blocks (headings, paragraphs, tables, figures) with page boxes. For RAG and extraction. See [Blocks and citations](https://docs.reducto.ai/office/docx/conversion/blocks.md) |
| `docx read <file>` | Prints a text sketch of each page |
| `docx text <file>` | Prints the document text |
| `docx find <file> <needle>` | Finds text and prints its address |
| `docx edit <op> <file>` | Applies one edit. Writes the input **in place** unless you pass `-o` |

## Common flags

| Flag | Notes |
| - | - |
| `-o, --out` | Output file (`pdf`, `json`) or folder (`png`) |
| `--pages 1,3,7-9` | Pages to paint (`png`) |
| `--scale K` | PNG scale. Default `2` |
| `--max-pages N` | Stop layout after N pages |
| `--tracked-changes final\|inline\|balloons` | Print the final view (default), show insertions and deletions inline, or show deletions and formatting changes in margin balloons |
| `--comments hidden\|balloons` | Hide comments (default) or show them in a margin |
| `--page-color print\|screen` | White page as Word prints (default), or the document's page colour |

Run `npx docx --help` for every flag.

## Examples

Print a redline PDF with comments:

```sh theme={null}
npx docx pdf contract.docx -o contract-redline.pdf --tracked-changes inline --comments balloons
```

Make page 1 thumbnails for a folder:

```sh theme={null}
for f in docs/*.docx; do npx docx png "$f" -o "thumbs/$(basename "$f" .docx)" --pages 1 --scale 0.5; done
```
