github razvandimescu/gopdf v0.5.0

latest releases: v0.11.2, v0.11.1, v0.11.0...
6 months ago

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 sortSpansByX helper (was duplicated 3x across table.go and text.go)
  • Added cmd/extract_tables demo for bank statement extraction
  • New unit tests covering MergeGap, MaxRowGap, and their combination

Full Changelog: v0.4.0...v0.5.0

Don't miss a new gopdf release

NewReleases is sending notifications on new releases.