## TL;DR

When OCR runs per page, the table header row repeats on every page and naive extraction emits it as a data row, corrupting totals and line counts. Fix it in post-processing: detect header-like rows by matching the known header pattern (column names, non-numeric cells, position at page top) and drop them, keeping only the first occurrence. Better, make extraction page-aware: mark rows by page and suppress header patterns on pages after the first. Validate by reconciling the extracted line count against the invoice's stated line count or totals.

## The query

```text
OCR table header repeated on every invoice page: deduping rows
```

## Use this when

- Multi-page invoice extraction with phantom header rows
- Line counts wrong on multi-page invoice OCR
- Repeated table headers in extraction output

## Not for

- Genuinely duplicated line items (different problem)
- Headers that change mid-document (handle as separate tables)

## Steps

1. Extract with page numbers attached to every row.
   Expected output: Rows are traceable to their page.
2. Define the header pattern: the column-name row from page one.
   Expected output: You have a template to match against.
3. Drop rows matching the header pattern on pages after the first.
   Expected output: Phantom rows are removed; real data stays.
4. Reconcile: extracted line count and totals vs the invoice's own totals.
   Expected output: The dedup is verified numerically.
5. Push the rule into your extraction post-processor as a standard pass.
   Expected output: Every multi-page invoice gets it automatically.

## Variant phrasings

### OCR table header repeated every page dedupe

### multi-page invoice header row extraction

### remove repeated headers invoice OCR

## Root cause

The header repeats because OCR sees pages, not documents: each page is an independent image with its own header row. Deduping is a document-level operation, which is why it belongs in post-processing after page-level extraction, not in the OCR engine.

## Edge cases

- Some invoices genuinely repeat a line item that looks like a header; reconcile totals before dropping
- Footers with page totals need similar treatment; do not confuse them with data rows

## Provenance

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