$npx -y skills add K-Dense-AI/scientific-agent-skills --skill liteparseLocal document and PDF parsing with spatial text and bounding boxes. Use for extracting text from PDFs, DOCX, Office files, and images; OCR on scans; layout-preserved JSON for RAG; batch-ingesting paper folders; or page screenshots for multimodal agents — even when the user does
| 1 | # LiteParse — Local Document Parsing |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | LiteParse is a fast, open-source document parser (Rust core, Python/Node bindings) focused on **local, layout-aware text extraction** with bounding boxes. It does not produce Markdown and does not call cloud LLMs. Outputs are **plain text** (layout-preserved) or **structured JSON** with per-page `text_items` (position, font metadata, optional confidence). |
| 6 | |
| 7 | **Version note:** Examples target **liteparse 2.0.0** (PyPI, May 2026). The upstream V1 branch is legacy; this skill documents **V2 / main** only. |
| 8 | |
| 9 | For parser selection vs MarkItDown, the `pdf` skill, or LlamaParse, see `references/choosing_a_parser.md`. |
| 10 | |
| 11 | ## When to Use This Skill |
| 12 | |
| 13 | Use LiteParse when you need: |
| 14 | |
| 15 | - **Fast local parsing** of PDFs or converted Office/image files without cloud dependencies |
| 16 | - **Spatial text** with bounding boxes for layout-aware RAG, citation grounding, or figure/table region logic |
| 17 | - **OCR** on scanned PDFs or images (bundled Tesseract, or a user-run HTTP OCR server) |
| 18 | - **Page screenshots** (PNG) for multimodal agents that must see charts, figures, or handwriting |
| 19 | - **Batch ingestion** of literature folders, supplementary PDFs, or protocol libraries |
| 20 | - **Page subsets** or **password-protected** PDFs |
| 21 | |
| 22 | ## When Not to Use |
| 23 | |
| 24 | | Task | Use instead | |
| 25 | |------|-------------| |
| 26 | | Markdown for LLM ingestion (EPUB, audio, YouTube, HTML) | `markitdown` skill | |
| 27 | | Merge/split PDFs, forms, watermarks, rotation | `pdf` skill | |
| 28 | | Dense tables, handwriting, production cloud pipelines | [LlamaParse](https://docs.cloud.llamaindex.ai/llamaparse/overview) (cloud; sign up separately) | |
| 29 | |
| 30 | ## Installation |
| 31 | |
| 32 | ```bash |
| 33 | uv pip install "liteparse==2.0.0" |
| 34 | ``` |
| 35 | |
| 36 | This installs the Python bindings and the **`lit`** CLI. Verify: |
| 37 | |
| 38 | ```bash |
| 39 | lit --help |
| 40 | python -c "import liteparse; print(liteparse.__version__)" |
| 41 | ``` |
| 42 | |
| 43 | **Optional system tools** (for non-PDF inputs): |
| 44 | |
| 45 | - **LibreOffice** — Word, Excel, PowerPoint, OpenDocument, CSV/TSV |
| 46 | - **ImageMagick** — PNG, JPEG, TIFF, WebP, SVG, etc. |
| 47 | |
| 48 | Install commands are in `references/ocr_and_formats.md`. |
| 49 | |
| 50 | **Node.js / TypeScript** (optional): `npm i @llamaindex/liteparse` — see `references/api_reference.md`. |
| 51 | |
| 52 | --- |
| 53 | |
| 54 | ## Quick Start |
| 55 | |
| 56 | ### Python |
| 57 | |
| 58 | ```python |
| 59 | from liteparse import LiteParse |
| 60 | |
| 61 | parser = LiteParse(quiet=True) |
| 62 | result = parser.parse("paper.pdf") |
| 63 | print(result.text) |
| 64 | |
| 65 | for page in result.pages: |
| 66 | print(f"Page {page.page_num}: {len(page.text_items)} items") |
| 67 | ``` |
| 68 | |
| 69 | ### CLI |
| 70 | |
| 71 | ```bash |
| 72 | # Layout-preserved text (default) |
| 73 | lit parse paper.pdf |
| 74 | |
| 75 | # Structured JSON with bounding boxes |
| 76 | lit parse paper.pdf --format json -o paper.json |
| 77 | |
| 78 | # Disable OCR on text-native PDFs (faster) |
| 79 | lit parse paper.pdf --no-ocr |
| 80 | ``` |
| 81 | |
| 82 | --- |
| 83 | |
| 84 | ## Core Workflows |
| 85 | |
| 86 | ### 1. Parse to layout-preserved text |
| 87 | |
| 88 | Best for quick full-document text or feeding chunkers that do not need coordinates. |
| 89 | |
| 90 | ```python |
| 91 | parser = LiteParse(ocr_enabled=True, quiet=True) |
| 92 | result = parser.parse("document.pdf") |
| 93 | full_text = result.text |
| 94 | ``` |
| 95 | |
| 96 | ```bash |
| 97 | lit parse document.pdf -o output.txt |
| 98 | ``` |
| 99 | |
| 100 | ### 2. Parse to structured JSON (bounding boxes) |
| 101 | |
| 102 | Use when building layout-aware RAG, highlighting source regions, or joining text with screenshots. |
| 103 | |
| 104 | ```python |
| 105 | import json |
| 106 | from liteparse import LiteParse |
| 107 | |
| 108 | parser = LiteParse(output_format="json", quiet=True) |
| 109 | result = parser.parse("document.pdf") |
| 110 | |
| 111 | # Programmatic access |
| 112 | for page in result.pages: |
| 113 | for item in page.text_items: |
| 114 | bbox = (item.x, item.y, item.width, item.height) |
| 115 | # item.text, item.confidence, item.font_name, item.font_size |
| 116 | ``` |
| 117 | |
| 118 | ```bash |
| 119 | lit parse document.pdf --format json -o document.json |
| 120 | ``` |
| 121 | |
| 122 | JSON field layout: `references/output_formats.md`. |
| 123 | |
| 124 | ### 3. Parse specific pages |
| 125 | |
| 126 | ```python |
| 127 | parser = LiteParse(target_pages="1-5,10,15-20", quiet=True) |
| 128 | result = parser.parse("long_paper.pdf") |
| 129 | ``` |
| 130 | |
| 131 | ```bash |
| 132 | lit parse long_paper.pdf --target-pages "1-5,10" |
| 133 | ``` |
| 134 | |
| 135 | ### 4. Parse from bytes or stdin |
| 136 | |
| 137 | Useful for uploads, S3 downloads, or piping remote PDFs. |
| 138 | |
| 139 | ```python |
| 140 | with open("document.pdf", "rb") as f: |
| 141 | result = parser.parse(f.read()) |
| 142 | ``` |
| 143 | |
| 144 | ```bash |
| 145 | curl -sL https://example.com/report.pdf | lit parse - |
| 146 | ``` |
| 147 | |
| 148 | ### 5. Page screenshots for multimodal agents |
| 149 | |
| 150 | Screenshots capture visual content that text extraction alone misses (figures, complex tables, handwriting). |
| 151 | |
| 152 | ```python |
| 153 | from pathlib i |