feat: detect tables from PDF line path operators (m/l/S)

Many IRS forms and government PDFs draw table gridlines using path
operators (m/l/S) instead of rectangle (re) operators. This adds
line-based table detection to capture these tables.

- Add PdfLine type for line segments from path operators
- Capture m/l/h/S/s/B/b/f/n path operators in content_stream.rs
- Thread Vec<PdfLine> through extraction pipeline
- New detect_lines.rs: classify lines, snap to grid, validate and
  assign items with extensive false-positive filters
- Integrate in markdown pipeline: rects first, then lines as fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Abimael Martell
2026-03-03 12:58:59 -08:00
co-authored by Claude Opus 4.6
parent 8adfacd3e3
commit 2b5fcd7bbb
7 changed files with 571 additions and 23 deletions
+2
View File
@@ -3,12 +3,14 @@
//! Detects tabular data in PDF text items and converts to markdown tables.
mod detect_heuristic;
mod detect_lines;
mod detect_rects;
mod financial;
mod format;
mod grid;
pub use detect_heuristic::detect_tables;
pub use detect_lines::detect_tables_from_lines;
pub use detect_rects::{detect_tables_from_rects, RectHintRegion};
pub use format::table_to_markdown;