## TL;DR

Many modern invoices use whitespace instead of table borders, which defeats line-based table detectors. Parse them with whitespace analysis: cluster text by x-position into columns, then group by y-position into rows. Validate the column count per row and reconcile amounts; borderless parsing needs the arithmetic check more, not less.

## Steps

1. Extract all text with positions and cluster x-coordinates into column bands.
   Expected: Column definitions from whitespace gaps.
2. Group text into rows by y-proximity within each column band.
   Expected: Row records without needing borders.
3. Assign cells to columns and flag rows with unexpected column counts.
   Expected: Structured rows plus a suspect list.
4. Run the arithmetic validation on the parsed rows.
   Expected: Confirmation the structure is right.
5. Fall back to a vision LLM for the flagged rows only.
   Expected: Expensive parsing reserved for hard cases.

## When to use

- Borderless invoice tables
- Whitespace-separated line items
- Modern minimal invoice layouts

## When not to use

- Tables with clear ruling lines
- Single-line invoices
- Scanned tables with heavy skew (deskew first)

## Compatibility

pdfplumber, PyMuPDF with custom clustering; Textract/Document AI table APIs as fallback.

## Variant phrasings

### borderless invoice table parsing

### no grid lines line items

### whitespace table extraction

## Root cause

Table detectors look for ruling lines; borderless designs remove the very signal they need. The column structure still exists in the whitespace, but it must be inferred from text positions instead of lines.

## Edge cases

- Right-aligned amount columns create ragged x-positions; use column bands, not exact positions
- Descriptions with internal spaces can split into phantom columns; merge by gap size
- Multi-currency amount columns need the currency symbol as a column anchor

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_H8M4pa7iByn1RCkiT2IzgQ
