Metadata-Version: 2.4
Name: rapiddoc-cli
Version: 0.1.0
Summary: CLI for RapidAI/RapidDoc — parse PDF/Office documents to Markdown/JSON/Word/HTML
Project-URL: Homepage, https://github.com/1WorldCapture/rapiddoc-cli
Project-URL: Repository, https://github.com/1WorldCapture/rapiddoc-cli
Project-URL: Issues, https://github.com/1WorldCapture/rapiddoc-cli/issues
Author: 1WorldCapture
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: cli,document-parsing,markdown,ocr,pdf,rapid-doc,rapiddoc
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing
Requires-Python: <3.14,>=3.11
Requires-Dist: rapid-doc[cpu,html,word]>=0.9.8
Description-Content-Type: text/markdown

# rapiddoc-cli

A command-line interface for [RapidAI/RapidDoc](https://github.com/RapidAI/RapidDoc) — parse PDF / image / Office documents into **Markdown / JSON / Word / HTML** with a single command.

RapidDoc is a high-performance document parsing pipeline (MinerU fork, VLM removed, ONNX-based) that runs on **CPU** — no GPU required.

## Install

```bash
# Recommended: isolated environment (doesn't pollute your system Python)
uv tool install rapiddoc-cli

# Or with pip
pip install rapiddoc-cli
```

Both expose the `rapiddoc` command. The first run downloads ONNX models (~50–100 MB) to a cache directory; subsequent runs reuse them.

## Usage

```bash
rapiddoc paper.pdf                      # → paper.out.md (default: Markdown)
rapiddoc report.pdf -f json             # → report.out.json
rapiddoc notes.docx -f word             # → notes.out.docx (Office native parsing)
rapiddoc scan.png -f html               # → scan.out.html
rapiddoc book.pdf -o book.md --lang en  # English OCR + custom output path
rapiddoc scan.png --no-formula          # skip formula recognition (faster)
```

### Options

```
rapiddoc <input> [options]

  -o, --output <path>               Output file path
  -f, --format <md|json|word|html>  Output format (default: md)
      --lang <ch|en|...>            OCR language (default: ch)
      --no-formula                  Disable formula recognition
      --no-table                    Disable table recognition
  -h, --help                        Show help
```

## Supported inputs

| Type | Formats | How it's parsed |
|---|---|---|
| PDF | `.pdf` | Model pipeline (OCR + layout + formula + table) |
| Images | `.png` `.jpg` `.jpeg` `.bmp` `.tiff` | Model pipeline |
| Office | `.docx` `.pptx` `.xlsx` | **Native parsing** (no models, very fast) |
| Legacy Office | `.doc` `.ppt` `.xls` | Converted to modern format first |

## Platform notes

- **macOS / Apple Silicon**: works out of the box. RapidDoc auto-detects the CPU and falls back to ONNX Runtime (OpenVINO is skipped automatically — no configuration needed).
- **Linux x86**: OpenVINO is used for OCR (fastest on CPU); other stages use ONNX Runtime.
- **No GPU required**: the whole pipeline runs on CPU. There is no CUDA/MPS path.

## How it works

`rapiddoc-cli` is a thin wrapper around the `rapid-doc` Python package. It:

1. Initializes a `RapidDoc` engine (OCR, layout, formula, table models loaded on demand)
2. Parses the input into an intermediate `middle_json` representation
3. Renders the requested output format:
   - **Markdown / JSON**: produced directly by the engine
   - **Word / HTML**: Markdown is generated first, then converted via `markdown_to_docx` / `markdown_to_html` (pypandoc / markdown-it-py)

## License

Apache-2.0 (same as upstream [rapid-doc](https://pypi.org/project/rapid-doc/)).
