What's New
Multi-line cell merging (MergeGap)
Tables with wrapped cell content (bank statements, invoices) can now be collapsed into logical rows. Consecutive rows within the specified Y-distance are merged, with text in the same column concatenated.
tbl := pdf.FindTable(spans, &pdf.TableOpts{
Headers: []string{"Date", "Description", "Debit", "Credit"},
MergeGap: 16, // merge rows within 16pt into one logical row
})Table boundary detection (MaxRowGap)
Tables now stop collecting rows when the gap between consecutive rows exceeds a threshold, preventing footer/disclaimer text from leaking into table data.
tbl := pdf.FindTable(spans, &pdf.TableOpts{
Headers: []string{"Date", "Amount"},
MaxRowGap: 30, // stop when gap > 30pt
})Other improvements
- Extracted
sortSpansByXhelper (was duplicated 3x across table.go and text.go) - Added
cmd/extract_tablesdemo for bank statement extraction - New unit tests covering MergeGap, MaxRowGap, and their combination
Full Changelog: v0.4.0...v0.5.0