889 B
889 B
pdf-to-markdown
Fast Rust library for PDF to Markdown conversion with smart scanned vs text-based detection.
Features
- Smart Detection - Detects scanned vs text-based PDFs in ~10-50ms by sampling content streams for text operators (
Tj/TJ) without loading the full document - Direct Extraction - Text extraction using lopdf with no external dependencies
- Structure Detection - Headers (by font size), lists, code blocks (monospace fonts)
- CLI Tools -
detect-pdfandpdf2mdbinaries included
How Detection Works
Instead of loading the entire PDF, we:
- Load only metadata (xref table, trailer, page count)
- Sample first ~5 pages' content streams
- Scan raw bytes for
Tj/TJ(text) andDo(image) operators - Classify based on text operator presence
This allows detecting 300+ page PDFs in milliseconds.