Skip to content

A fast, helpful, and open-source document parser

liteparse -> lit

Logan Markewich3f5b990e1a1f
diff --git a/OCR_API_SPEC.md b/OCR_API_SPEC.md
index 9855580..a3c9328 100644
--- a/OCR_API_SPEC.md
+++ b/OCR_API_SPEC.md
@@ -176,7 +176,7 @@ curl -X POST http://localhost:8080/ocr \
Use with LiteParse:
```bash
-pnpm parse document.pdf --ocr-server-url http://localhost:8080/ocr
+lit parse document.pdf --ocr-server-url http://localhost:8080/ocr
```
## FAQ
diff --git a/README.md b/README.md
index 52880d8..c6a104d 100644
--- a/README.md
+++ b/README.md
@@ -34,20 +34,11 @@ npm i -g @llamaindex/liteparse
Then use it:
```bash
-liteparse parse document.pdf
-liteparse screenshot document.pdf
+lit parse document.pdf
+lit screenshot document.pdf
```
-#### Option 2: Use with npx
-
-Run directly without installing:
-
-```bash
-npx liteparse parse document.pdf
-npx liteparse screenshot document.pdf
-```
-
-#### Option 3: Homebrew (macOS/Linux)
+#### Option 2: Homebrew (macOS/Linux)
Coming soon! Once published, you'll be able to install via Homebrew:
@@ -56,7 +47,7 @@ brew tap yourusername/liteparse
brew install liteparse
```
-#### Option 4: Instal from Source
+#### Option 3: Instal from Source
You can clone the repo and install the CLI globally from source:
@@ -70,22 +61,22 @@ npm install -g ./liteparse-*.tgz
## Usage
-### Parse PDF Files
+### Parse Files
You can run tests without building the binary using the CLI:
```bash
# Basic parsing
-liteparse parse document.pdf
+lit parse document.pdf
# Parse with specific format
-liteparse parse document.pdf --format json -o output.md
+lit parse document.pdf --format json -o output.md
# Parse specific pages
-liteparse parse document.pdf --target-pages "1-5,10,15-20"
+lit parse document.pdf --target-pages "1-5,10,15-20"
# Parse without OCR
-liteparse parse document.pdf --no-ocr
+lit parse document.pdf --no-ocr
```
### Batch Parsing
@@ -93,7 +84,7 @@ liteparse parse document.pdf --no-ocr
You can also parse an entire directory of documents:
```bash
-liteparse batch-parse ./input-directory ./output-directory
+lit batch-parse ./input-directory ./output-directory
```
### Generate Screenshots
@@ -102,16 +93,16 @@ Screenshots are essential for LLM agents to extract visual information that text
```bash
# Screenshot all pages
-liteparse screenshot document.pdf -o ./screenshots
+lit screenshot document.pdf -o ./screenshots
# Screenshot specific pages
-liteparse screenshot document.pdf --pages "1,3,5" -o ./screenshots
+lit screenshot document.pdf --pages "1,3,5" -o ./screenshots
# Custom output directory and DPI
-liteparse screenshot document.pdf -o ./images --dpi 300 -o ./screenshots
+lit screenshot document.pdf -o ./images --dpi 300 -o ./screenshots
# Screenshot page range
-liteparse screenshot document.pdf --pages "1-10" -o ./screenshots
+lit screenshot document.pdf --pages "1-10" -o ./screenshots
```
### Library Usage
@@ -137,28 +128,33 @@ console.log(result.text);
#### Parse Command
```
-$ liteparse parse <file> [options]
+$ lit parse --help
+Usage: lit parse [options] <file>
+
+Parse a document file (PDF, DOCX, XLSX, PPTX, images, etc.)
Options:
- -o, --output <file> Output file path
- --format <format> Output format: json|text (default: "text")
- --ocr-server-url <url> HTTP OCR server URL (uses Tesseract if not provided)
- --no-ocr Disable OCR
- --ocr-language <lang> OCR language(s) (default: "en")
- --max-pages <n> Max pages to parse (default: "1000")
- --target-pages <pages> Target pages (e.g., "1-5,10,15-20")
- --pdf-engine <engine> PDF engine: pdfjs|pdfium (default: "pdfjs")
- --dpi <dpi> DPI for rendering (default: "150")
- --no-precise-bbox Disable precise bounding boxes
- --skip-diagonal-text Skip diagonal text
- --preserve-small-text Preserve very small text
- --config <file> Config file (JSON)
+ -o, --output <file> Output file path
+ --format <format> Output format: json|text (default: "text")
+ --ocr-server-url <url> HTTP OCR server URL (uses Tesseract if not provided)
+ --no-ocr Disable OCR
+ --ocr-language <lang> OCR language(s) (default: "en")
+ --max-pages <n> Max pages to parse (default: "10000")
+ --target-pages <pages> Target pages (e.g., "1-5,10,15-20")
+ --dpi <dpi> DPI for rendering (default: "150")
+ --no-precise-bbox Disable precise bounding boxes
+ --skip-diagonal-text Skip diagonal text
+ --preserve-small-text Preserve very small text
+ --config <file> Config file (JSON)
+ -q, --quiet Suppress progress output
+ -h, --help display help for command
```
#### Batch Parse Command
```
-$ liteparse batch-parse --help
+$ lit batch-parse --help
+Usage: lit batch-parse [options] <input-dir> <output-dir>
Parse multiple documents in batch mode (reuses PDF engine for efficiency)
@@ -180,14 +176,19 @@ Options:
#### Screenshot Command
```
-$ liteparse screenshot <file> [options]
+$ lit screenshot --help
+Usage: lit screenshot [options] <file>
+
+Generate screenshots of PDF pages
Options:
- -o, --output-dir <dir> Output directory for screenshots (default: "./screenshots")
- --pages <pages> Page numbers to screenshot (e.g., "1,3,5" or "1-5")
- --dpi <dpi> DPI for rendering (default: "150")
- --format <format> Image format: png|jpg (default: "png")
- --config <file> Config file (JSON)
+ -o, --output-dir <dir> Output directory for screenshots (default: "./screenshots")
+ --pages <pages> Page numbers to screenshot (e.g., "1,3,5" or "1-5")
+ --dpi <dpi> DPI for rendering (default: "150")
+ --format <format> Image format: png|jpg (default: "png")
+ --config <file> Config file (JSON)
+ -q, --quiet Suppress progress output
+ -h, --help display help for command
```
## OCR Setup
@@ -196,13 +197,13 @@ Options:
```bash
# Tesseract is enabled by default
-pnpm parse document.pdf
+lit parse document.pdf
# Specify language
-pnpm parse document.pdf --ocr-language fra
+lit parse document.pdf --ocr-language fra
# Disable OCR
-pnpm parse document.pdf --no-ocr
+lit parse document.pdf --no-ocr
```
### Optional: HTTP OCR Servers
@@ -293,7 +294,7 @@ For HTTP OCR servers, just add `ocrServerUrl`:
Use with:
```bash
-pnpm parse document.pdf --config liteparse.config.json
+lit parse document.pdf --config liteparse.config.json
```
## Development
diff --git a/cli/README.md b/cli/README.md
index 0493011..f10d0ca 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -11,70 +11,15 @@ Command-line interface for LiteParse using Commander.js.
## Commands
-### `liteparse parse <file>`
-Parse documents and extract text.
+### `lit parse <file>`
-**Options:**
-| Flag | Description | Default |
-|------|-------------|---------|
-| `-o, --output <file>` | Save output to file | stdout |
-| `--format <format>` | Output format: `json` or `text` | `text` |
-| `--ocr-server-url <url>` | HTTP OCR server URL | (uses Tesseract) |
-| `--no-ocr` | Disable OCR entirely | enabled |
-| `--ocr-language <lang>` | OCR language code | `en` |
-| `--max-pages <n>` | Maximum pages to parse | `1000` |
-| `--target-pages <pages>` | Specific pages (e.g., "1-5,10") | all |
-| `--dpi <dpi>` | Render resolution | `150` |
-| `--no-precise-bbox` | Disable bounding boxes | enabled |
-| `--skip-diagonal-text` | Skip diagonal/rotated text | false |
-| `--preserve-small-text` | Keep very small text | false |
-| `--config <file>` | Load config from JSON file | - |
-| `-q, --quiet` | Suppress progress output | false |
-
-**Examples:**
-```bash
-# Basic text extraction
-liteparse parse document.pdf
-
-# JSON output with OCR disabled
-liteparse parse document.pdf --format json --no-ocr
-
-# Parse specific pages
-liteparse parse document.pdf --target-pages "1-5,10,15-20"
-
-# Use external OCR server
-liteparse parse document.pdf --ocr-server-url http://localhost:5000/ocr
-
-# Save to file
-liteparse parse document.pdf -o output.txt
-```
+Parse documents and extract text.
---
-### `liteparse screenshot <file>`
-Generate page screenshots.
+### `lit screenshot <file> -o <output_dir>`
-**Options:**
-| Flag | Description | Default |
-|------|-------------|---------|
-| `-o, --output-dir <dir>` | Output directory | `./screenshots` |
-| `--pages <pages>` | Page numbers (e.g., "1,3,5" or "1-5") | all |
-| `--dpi <dpi>` | Render resolution | `150` |
-| `--format <format>` | Image format: `png` or `jpg` | `png` |
-| `--config <file>` | Load config from JSON file | - |
-| `-q, --quiet` | Suppress progress output | false |
-
-**Examples:**
-```bash
-# All pages as PNG
-liteparse screenshot document.pdf
-
-# Specific pages as JPG at 300 DPI
-liteparse screenshot document.pdf --pages "1,3,5" --format jpg --dpi 300
-
-# Custom output directory
-liteparse screenshot document.pdf -o ./my-screenshots
-```
+Generate page screenshots.
---
@@ -98,24 +43,6 @@ CLI options override config file values.
---
-## Output Behavior
-
-- **Progress messages** go to stderr (visible in terminal)
-- **Parsed content** goes to stdout (can be piped)
-- Use `-o` to save to file instead of stdout
-- Use `-q` to suppress all progress messages
-
-**Piping example:**
-```bash
-# Extract and search
-liteparse parse document.pdf -q | grep "keyword"
-
-# Chain with other tools
-liteparse parse document.pdf --format json -q | jq '.pages[0].text'
-```
-
----
-
## Adding CLI Options
1. Add `.option()` call in the command definition
diff --git a/cli/parse.ts b/cli/parse.ts
index b08b907..9addd5c 100644
--- a/cli/parse.ts
+++ b/cli/parse.ts
@@ -58,7 +58,7 @@ interface BatchParseCommandOptions {
const program = new Command();
program
- .name("liteparse")
+ .name("lit")
.description("OSS document parsing tool (supports PDF, DOCX, XLSX, images, and more)")
.version("1.0.0");
diff --git a/ocr/README.md b/ocr/README.md
index 5987c13..0d1929e 100644
--- a/ocr/README.md
+++ b/ocr/README.md
@@ -52,7 +52,7 @@ Then use with LiteParse:
```bash
# CLI
-liteparse parse document.pdf --ocr-server-url http://localhost:8828/ocr
+lit parse document.pdf --ocr-server-url http://localhost:8828/ocr
# Code
const parser = new LiteParse({
diff --git a/ocr/easyocr/README.md b/ocr/easyocr/README.md
index 84ad41e..b067930 100644
--- a/ocr/easyocr/README.md
+++ b/ocr/easyocr/README.md
@@ -66,10 +66,10 @@ Once the server is running, use it with LiteParse OSS:
```bash
# Parse with EasyOCR
-pnpm parse document.pdf --ocr-server-url http://localhost:8828/ocr
+lit parse document.pdf --ocr-server-url http://localhost:8828/ocr
# With specific language
-pnpm parse document.pdf --ocr-server-url http://localhost:8828/ocr --ocr-language zh
+lit parse document.pdf --ocr-server-url http://localhost:8828/ocr --ocr-language zh
```
Or in code:
diff --git a/ocr/paddleocr/README.md b/ocr/paddleocr/README.md
index 706ec26..6e30909 100644
--- a/ocr/paddleocr/README.md
+++ b/ocr/paddleocr/README.md
@@ -80,10 +80,10 @@ Once the server is running, use it with LiteParse:
```bash
# Parse with PaddleOCR
-pnpm parse document.pdf --ocr-server-url http://localhost:8829/ocr
+lit parse document.pdf --ocr-server-url http://localhost:8829/ocr
# With specific language
-pnpm parse document.pdf --ocr-server-url http://localhost:8829/ocr --ocr-language zh
+lit parse document.pdf --ocr-server-url http://localhost:8829/ocr --ocr-language zh
```
Or in code:
diff --git a/package.json b/package.json
index 6268724..1ac314a 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"main": "./dist/src/lib.js",
"types": "./dist/src/lib.d.ts",
"bin": {
+ "lit": "./dist/src/index.js",
"liteparse": "./dist/src/index.js"
},
"exports": {