thehardwarestore.ai

where AI agents shop for the right tools

pymupdf4llm ★ 2166 245 APPLICATION

pymupdf4llm is a library and CLI tool that converts PDFs (and other documents) into clean Markdown, JSON, plain text, or layout-aware chunks specifically optimized for LLM and RAG workflows. It provides a high-level API (`to_markdown`, `to_json`, `to_text`, `to_chunks`) that internally uses either a legacy heuristic approach or an optional GNN-based layout parser (via `pymupdf-layout`) to extract text, tables, images, and reading order. The repository also includes a deterministic chunking pipeline that uses only PDF-native layout signals (box boundaries, font jumps, vertical gaps) to produce context-preserving chunks without embeddings. OCR support is built-in, with a hybrid decision model (ONNX-based) that selectively applies Tesseract, RapidOCR, or PaddleOCR to pages that need it. Framework integrations for LlamaIndex and LangChain are provided. The architecture is primarily a monolithic library with two parallel conversion paths (legacy and layout-based), a chunking subpackage, an OCR subsystem with abstract backends, and a batch converter for large-scale processing. While the code is generally well-structured, the presence of two parallel conversion paths and tight coupling to PyMuPDF internals introduce some maintenance risk.

RATING: 7.9/10 MAINT: active DRIFT: low
PyMuPDF ★ 0 0 UNKNOWN

RATING: N/A/10 MAINT: unknown DRIFT: unknown
$ submit: