Commit Graph
18 Commits
Author SHA1 Message Date
Abimael Martell 9078c7bd14 improve spacing detection 2026-02-11 14:12:16 -08:00
Abimael Martell 8d0ce9ea0a fix(encoding): Fix CJK/Unicode encoding bug 2026-02-11 12:33:06 -08:00
Abimael Martell 68643e0c37 fix encoding, and spacing on custom fonts 2026-02-11 12:17:42 -08:00
Abimael MartellandClaude Opus 4.5 cd68515028 Add image and hyperlink extraction, improve line grouping
- Add ItemType enum to distinguish Text, Image, and Link items
- Extract XObject images from page resources with position/dimensions
- Parse Link annotations to extract hyperlinks with URLs
- Add include_images and include_links options to MarkdownOptions
- Fix line grouping to better detect new lines vs same-line items
- Add samples/ and scripts/ to .gitignore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 08:31:20 -08:00
Abimael Martell 5afbb67b90 Fix list continuation, improve table detection, and add more font styling detection 2026-02-10 13:30:33 -08:00
Abimael Martell 6389c85ab9 fix type 2026-02-09 12:56:08 -08:00
Abimael Martell 3d6772fc20 improve spacing detection, and layout detection 2026-02-09 12:45:08 -08:00
Abimael Martell ec96311a65 implement ToUnicode CMap support for proper text extraction from PDFs with custom font encodings 2026-02-09 09:46:07 -08:00
Abimael Martell 5e44e468ac Formatting Improvements
1. Word Fragment Joining (extractor.rs:63-94)

  Added is_word_continuation() to detect when text items are fragments of the same word and should be joined without spaces:

2. Caption Detection (markdown.rs:621-658)

  Added is_caption_line() to detect figures, tables, and source citations:
  - Ensures captions are on their own line with paragraph breaks

3. Paragraph Threshold Adjustment

  Changed from base_size * 2.0 to base_size * 1.8 for better paragraph detection.
2026-02-08 21:58:02 -08:00
Abimael Martell d530f9c888 implement Subscript/Superscript detection 2026-02-07 22:27:54 -08:00
Abimael Martell 4f66cf1a6e clippy happy 2026-02-07 20:16:44 -08:00
Abimael Martell 2953ec8203 fix: Page number filtering, Hyphen joining and Column detection threshold 2026-02-07 20:14:23 -08:00
Abimael Martell 3548423747 fix sorting 2026-02-07 19:57:05 -08:00
Abimael Martell 96bdaa9f4a fix sorting, and columns 2026-02-07 18:25:01 -08:00
Abimael MartellandClaude Opus 4.5 5f772071e4 Fix formatting
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 13:48:46 -08:00
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 Martell 0ef7b2adfc add ci, plus new package 2026-02-06 21:39:21 -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