firecrawl /pdf-inspector
Fast Rust library for PDF inspection, classification, and text extraction. Intelligently detects scanned vs text-based PDFs to enable smart routing decisions.
★ 20,037⑂ 1,366👁 51⑃ 498● 153▤ 15
+11
日增长
+220
周增长
+410
月增长
20,037
stars
1,366
forks
51
watchers
498
prs
153
issues
15
releases
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
Top issues
#246Partial CJK corruption on CIDFontType2 subsets whose ToUnicode is a full-range identity bfrange (dompdf)0 comments · 2026-08-04#252extract_pages_markdown_bytes() flags every page as needs_ocr on a plain text-based PDF, contradicting detect_pdf_bytes()0 comments · 2026-08-04#212Arabic (RTL) text is returned in visual order, not logical order9 comments · 2026-08-02#286Valid PDF rejected as `malformed document: invalid PDF structure` when more than 506 trailing bytes follow `%%EOF`0 comments · 2026-08-06#270Ruled table splits into multiple tables when a single cell wraps to more than one line2 comments · 2026-08-05#220Feature: distinct-n self-check to catch duplicated output (well-encoded but repeated text)2 comments · 2026-08-02#290Making V2RAY Proxies0 comments · 2026-08-06#276Scanned/ImageBased page_signals empty case untested1 comments · 2026-08-05
Discussions
Latest release
1.26.0 — Strikethroughs kept in redlines and tables v1.26.0 2026-11-14Changes since 1.25.2: - Keep strikethroughs on pages that strike several lines of similar width, as tracked-changes documents do: the repeated-ruling filter only kept such a rule when it underlined the row it fits, so every one of these strikes was dropped as a table ruling. A rule that snugly strikes through one row is now kept, and the underlined row and the struck row are judged apart so neighbouring rows never combine into one owner (663). - Keep strikethroughs on text inside a detected table: clearing the decorations of table text exists for underlines, which a cell's bottom border imita
相关报道 (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