feat(tables): detect tables from clip-path rects via merged-cluster fallback

Extract axis-aligned rectangles from W/W* clip operators in content
streams — many PDFs define table cells as clipping paths instead of
stroked rects. Add merged-cluster fallback in detect_tables_from_rects()
that merges all cluster rects when per-cluster detection fails or only
produces narrow false-positives (≤3 columns). Uses rect Y-edges for
rows and text X-clustering for columns.

Also updates lopdf to firecrawl fork (fix-leading-whitespace branch).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Abimael Martell
2026-03-05 17:12:26 -08:00
co-authored by Claude Opus 4.6
parent 5e260cb1b3
commit 5ab92e03e3
3 changed files with 262 additions and 1 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ repository = "https://github.com/firecrawl/pdf-inspector"
[dependencies]
# PDF parsing
lopdf = { git = "https://github.com/J-F-Liu/lopdf", rev = "dc2887a", features = ["rayon"] }
lopdf = { git = "https://github.com/firecrawl/lopdf", branch = "firecrawl/fix-leading-whitespace", features = ["rayon"] }
# Error handling
thiserror = "2.0"