19,979
stars
+162+169+483
1,358
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions
README
pdf-inspector Fast Rust library for PDF classification and text extraction. By default it detects whether a PDF is text-based or scanned, extracts text with position awareness, and converts to clean Markdown without OCR. Native Rust and CLI consumers can opt into selective OCR. Includes bindings for Python, Node.js, and browser WebAssembly. Built by Firecrawl to handle text-based PDFs locally in under 200ms, skipping expensive OCR services for the ~54% of PDFs that don't need them. Features - Smart classification — Detect TextBased, Scanned, ImageBased, or Mixed PDFs in ~10-50ms by sampling content streams. Returns a confidence score (0.0-1.0) and per-page OCR routing. - Text extraction — Position-aware extraction with font info, X/Y coordinates, and automatic multi-column reading order. Rotated runs (margin stamps, chart axis titles) keep a true axis-aligned box and report their rotation angle instead of collapsing to zero width. - Markdown conversion — Headings (H1-H4 via font size ratios), bullet/numbered/letter lists, code blocks (monospace font detection), tables (rectangle-based and heuristic), bold/italic formatting, URL linking, and page breaks. - Table detection — Dual-mode: rectangle-based detection from PDF drawing ops, plus heuristic detection from text alignment. Handles financial tables, footnotes, and continuation tables across pages. - CID font support — ToUnicode CMap decoding for Type0/Identity-H fonts, UTF-16BE, UTF-8, and Latin-1 encodings. - Multi-column layout — Automatic detection of newspaper-style columns, sequential reading order, and RTL text support. - Encoding issue detection — Automatically flags broken font encodings so callers can fall back to OCR. - Selective OCR — Rust, CLI, Python, and Node can render only pages that need OCR, run PP-OCRv6 Small locally, and preserve per-page provenance and hosted-fallback recommendations. - Single document load — The document is parsed once and shared between detection and extraction, avoiding redundant I/O. - Browser WebAssembly — Run the same Rust parser locally in browsers and Web Workers, with embedded CMaps and no server round trip. - Lightweight by default — The default Rust and browser builds remain pure extraction. Native Python and Node packages include the OCR integration, but PDFium, ONNX Runtime, and model files remain external and are touched only when a page is routed to OCR. Benchmark Evaluated on the opendataloader-bench corpus (200 PDFs). Only local engines without model-based PDF parsing are shown; OCR was disabled. Scores are 0-1, higher is better. | Engine | Overall | Reading Order (NID) | Tables (TEDS) | Headings (MHS) | Speed (200 docs) | |---|---|---|---|---|---| | pdf-inspector | 0.875 | 0.915 | 0.814 | 0.788 | 0.470s | | liteparse | 0.873 | 0.913 | 0.693 | 0.811 | 0.750s | | opendataloader | 0.831 | 0.902 | 0.489 | 0.739 | 2.569s | | pymupdf4llm | 0.735 | 0.886 | 0.401 | 0.424 | 17.117s | | markitdown | 0.589 | 0.844 | 0.273 | 0.000 | 16.1
相关报道 (4)
blog.csdnGitHub开源项目静态工程审阅:用Valhalla思维解析pdf-inspector源码2026-09-19xGithubトレンド on X: "9/2 19:28 JST|GitHub Trendingから2件:pdf-inspector / patent-disclosure-skill。中身はスレッドで紹介します。"2026-09-02blog.csdnGitHub每日热评|Valhalla 静态工程审阅 |pdf-inspector 源码证据驱动评测2026-08-09notepdf-inspectorとは?RAGのコストを削減するPDF解析ライブラリの使い方をエンジニア向けに解説2026-08-03
News & coverage (4)
Hacker NewsPdf-inspector: Rust lib for PDF inspection, classification, and text extraction▲ 5 · 1 comments · 2026-08-02Hacker NewsFast Rust Library for PDF text extraction▲ 5 · 0 comments · 2026-08-01noteWhat is pdf-inspector? An Engineer's Guide to a PDF Parsing Library That Reduces RAG Costs2026-08-03www.linuxuprising.comHow To Edit PDF Metadata Tags On Linux Using A GUI Or Command Line2021-01-25