On page one of a two-page invoice, the last line ends with “Calibration service —”. Page two repeats the column headers, then starts with “onsite follow-up” and an amount. Your extractor reads every word and every digit correctly. It still creates two line items where the invoice has only one.
That is not an OCR error. It is a boundary error. The system confused the layout of the PDF with the structure of the record.
Treat table continuation and row continuation as separate decisions. Preserve the original page evidence whether you join the fragments or send them for review. Then test what happens when the page break moves.
1. Decide whether the table continues
A repeating header is a useful signal, not proof. Two sections of an itemized invoice can have the same columns and still represent different charge groups. A monthly statement can finish transactions on one page and begin a fee summary on the next. Appending rows because their columns align can produce plausible JSON that is wrong.
Check signals in combination:
- Does the next page repeat the same invoice identifier, account reference or section heading?
- Do headers and column roles align, even if margins or page width differ?
- Does the previous page end with a final total, a signature or a new section? A page subtotal alone may not end the table.
- Does the next page explicitly say “continued,” or does it introduce a new section that happens to use the same headers?
The PDF Association’s tagged-PDF guide distinguishes a logical table from repeated visual headers in properly tagged documents. Use such structure when present and trustworthy. For scanned or untagged pages, derive the relationship from the page content and capture the reasons for the decision. If the signals conflict, do not force a merge just to return a complete-looking result.
2. Decide whether the row continues
Even after establishing that the table continues, the first data fragment on the next page might start a new row. Decide separately whether it completes the last row on the preceding page.
A row identifier or a clearly new item code is useful evidence of a new row. A continuation indent, incomplete description above the break and an amount that appears only in the fragment below can support a join. None of these clues is sufficient in isolation. Many genuine rows omit an ID, and a numeric amount alone does not show which row it belongs to.
For the fictional invoice above, suppose row 17 begins on page one and its description and amount finish on page two. An expected record could contain:
- Row ID: 17.
- Description: Calibration service — onsite follow-up.
- Amount in minor units: 12500; currency: USD.
- Status: joined across pages.
- Source parts: page 1 contains the row ID and description start; page 2 contains the description end and amount.
The dollar amount is illustrative. “Minor units” means cents for USD. In a production schema, keep the coordinate system consistent and add the original bounding boxes where they are available. If the link is uncertain, keep both fragments, leave the amount unassigned and emit a review reason. A reviewer should not have to reverse-engineer a guessed merge from a single output row.
3. Keep totals and repeated text out of the line items
Give each extracted row a role before applying accounting rules. Common roles include detail row, repeated header, subtotal, carried balance and final total. Preserve rows that reviewers or downstream systems need, but do not treat all of them as payable items.
For example, page one has $240 in detail items and a $240 subtotal. Page two starts with a $240 balance carried forward, adds $125 of detail, and shows a $365 final total. The correct detail sum is $365. The subtotal and carry-forward are not two additional charges. Real documents also have taxes, discounts and credits: define explicitly whether those belong in the detail sum or a separate reconciliation step. Do not silently force the arithmetic to balance by inserting, dropping or editing rows.
Keep legitimate duplicate rows. Two matching charges with different source positions may both be real. Deduplicate repeated layout elements using their role and evidence, not a blanket rule that discards identical descriptions and amounts.
4. Link before you flatten
You can return one logical table even if the inputs remain page-level fragments. Keep those fragments attached to the original geometry and construct the business-facing rows separately. AWS’s multi-page Textract example illustrates this distinction: its link mode preserves page geometry, whereas its merge mode moves later cells into the first page’s table representation. The same design choice matters whether you use OCR, a PDF parser or a multimodal model.
Preserving the page and fragment mapping also makes review actionable: a reviewer can check the amount on the second page without losing the description on the first. Keep raw values and normalized values separate where conventions such as dates, signs or currency could change meaning. The extraction-contract guide has a broader checklist for defining those output rules.
5. Move the page break, not the business facts
Start with one fictional fixture and label the logical rows by hand. Render the same underlying rows with a break between rows, a break inside a wrapped description, and a break immediately before the final total. Keep the expected logical output the same; only the evidence locations should move. Add two negative controls: two separate tables with identical headings, and two legitimate identical detail rows. For scan-heavy intake, repeat a small subset under one representative capture problem to isolate the effect of reading quality.
Score the outcomes separately:
- Boundary decisions: false table joins, missed joins and incorrect split-row joins.
- Row integrity: missing or duplicate detail rows, amounts attached to the wrong row and legitimate duplicates wrongly removed.
- Reconciliation: exceptions against the explicit subtotal, tax, credit and final-total rules.
- Evidence: every critical value can be traced to the right page or is visibly held for review.
Report counts as well as rates. On a small fixture set, one false join can dominate the rate; it can also be the one error that causes a payment mistake. Set release criteria to match the downstream risk. For a payment workflow, a reasonable test gate is that no unresolved cross-page join silently reaches the payment payload. This is a proposed gate, not an accuracy claim.
A stable document pipeline should produce the same record when the same facts are repaginated, and make uncertainty explicit when it cannot. To inspect paired synthetic PDFs and reference files for your first fixtures, start with the GritWorks sample datasets. Review their layouts and add the page-break cases your workflow actually needs.


