Commit Graph
107 Commits
Author SHA1 Message Date
Abimael MartellandClaude Opus 4.5 c14e26495d Improve text extraction with visual reading order and header detection
Major changes:
- Switch from lopdf.extract_text() to position-aware extraction
- Text is now sorted by visual reading order (top→bottom, left→right)
- Fixed font size calculation to account for text matrix scaling
- Headers are now detected based on font size ratios
- Skip very short text (≤3 chars) for header detection to avoid drop caps

This significantly improves output quality for PDFs with complex layouts.
Before: Title appeared at end, no structure detected
After: Correct reading order, headers marked with # syntax

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 13:34:37 -08:00
Abimael MartellandClaude Opus 4.5 f99d155c52 Fix panic on multi-byte UTF-8 characters in list detection
The previous code used `trimmed.len() >= 2` to check if there were at
least 2 characters, but `len()` returns byte count, not character count.
For multi-byte UTF-8 characters (e.g., "é" which is 2 bytes), this check
would pass but `chars().nth(1)` would return None, causing a panic.

Fixed by using iterator pattern matching to safely extract the first
two characters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:20:17 -08:00
Abimael Martell 286c61d128 fix ci 2026-02-06 21:40:11 -08:00
Abimael Martell 0ef7b2adfc add ci, plus new package 2026-02-06 21:39:21 -08:00
Abimael Martell ee09e96cc4 add tests and readme 2026-02-06 17:58:27 -08:00
Abimael Martell 5c422abc63 add readme 2026-02-06 11:54:01 -08:00
Abimael MartellandClaude Opus 4.5 135ce518c1 Initial commit: Rust PDF-to-Markdown library
- Smart PDF type detection (text vs scanned) without full document load
- Text extraction using lopdf directly
- Markdown conversion with header/list/code detection
- CLI tools: detect-pdf, pdf2md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 11:51:41 -08:00