Last reviewed September 1, 2026

How do I extract line items when they span multiple pages?

Direct answer

Treat the document as one unit, not a stack of pages. Page-by-page extraction is what breaks multi-page tables: repeated column headers get read as data, "carried forward" subtotals get counted twice, and a row split across a page break becomes two half-rows. Send the whole document in one request so the reader sees the continuation, ask for a row type on every row so summary lines are labelled rather than mixed into the data, and then verify with counts and sums against the totals the document prints itself.

01

The four ways multi-page tables fail

Each of these is easy to spot once you know its signature, and each has a structural fix rather than a tuning fix.

  • Repeated headers: "Date | Description | Amount" appears on every page and becomes a row whose amount is null or zero.
  • Carried-forward double counting: page two opens with the page-one subtotal, which then gets added again into your sum.
  • Split rows: a long description wraps across the page break and produces two rows, one with an amount and one without.
  • Order scrambling: pages processed in parallel come back out of order, so a running balance no longer runs.
02

One request, whole document — and what that costs

The structural fix is to stop splitting. When the extractor sees the whole document, continuation is visible: it can tell that the row beginning on page two is the tail of the row that started on page one, and that the line reading "Balance carried forward" is not a purchase.

On Dokyumi that has a specific, predictable price. One credit covers a document of up to 5 pages, and a document consumes one more credit per additional 5 pages. Self-serve plans stop at 50 pages per document. So a 12-page statement is one API call and 3 credits, not 12 metered pages. If your documents routinely exceed the self-serve ceiling, that is an Enterprise conversation rather than a reason to start chopping files.

One caveat worth planning for: splitting a document to dodge a page limit re-creates every failure mode listed above. If you must split, split at a boundary the document itself defines — a section, an account, a statement period — and never mid-table.

03

Design the array so duplicates are detectable

Add two fields that are not "data" in the business sense but make verification possible: a row type and a page number. Row type turns the summary lines into labelled objects you can filter out. Page number gives you a way to spot ordering problems and to point a reviewer at the right sheet of paper.

Both are model-produced values like everything else in the response, so treat them as claims to be checked rather than facts. The check is cheap: page numbers should be non-decreasing down the array, and the count of item rows should match any row count the document states.

04

Reconcile with the document’s own totals

Most business documents that run to multiple pages print at least one control total: an invoice total, a closing balance, a page count, sometimes an explicit line count. Capture those as separate fields and let your code compare.

Three comparisons cover the failure modes. Item rows must sum to the stated total. The extracted row count must match a stated count when one exists. And no item row may duplicate a carried-forward value — that specific coincidence is the double-count signature, and catching it automatically is worth more than an hour of manual checking.

Copy-pasteable artifact

A multi-page statement schema, and the shape of a correct answer

This schema captures the document’s own control values alongside the rows, which is what makes automatic verification possible. The second pane shows the output for a three-page statement where page two opens with a carried-forward line — the exact case that silently inflates totals.

multipage-statement.schema.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Multi-page statement with control totals",
  "type": "object",
  "required": ["account_number", "period_start", "period_end", "closing_balance", "rows"],
  "properties": {
    "account_number":   { "type": "string", "minLength": 1 },
    "period_start":     { "type": "string", "format": "date" },
    "period_end":       { "type": "string", "format": "date" },
    "opening_balance":  { "type": ["number", "null"] },
    "closing_balance":  { "type": "number" },
    "stated_page_count":{ "type": ["integer", "null"], "minimum": 1 },
    "stated_row_count": { "type": ["integer", "null"], "minimum": 0 },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["row_type", "page", "description", "amount"],
        "properties": {
          "row_type":    { "enum": ["item", "header", "carried_forward", "subtotal", "total"] },
          "page":        { "type": "integer", "minimum": 1 },
          "date":        { "type": ["string", "null"], "format": "date" },
          "description": { "type": "string" },
          "amount":      { "type": ["number", "null"] },
          "balance":     { "type": ["number", "null"] }
        }
      }
    }
  }
}

Check three is the one to keep if you only keep one. Opening balance plus movements equals closing balance is an end-to-end proof that no row was dropped, duplicated, or misread — across every page at once.

Checklist

Multi-page reconciliation checklist

Six things to confirm before a multi-page extraction is allowed into a system of record.

  1. 1

    The whole document went in one request

    If your pipeline splits files, log where it splits. Splits mid-table are the root cause of most row problems.

  2. 2

    Header rows are labelled, not counted

    Filter by row type rather than trying to detect headers by heuristics downstream.

  3. 3

    Carried-forward lines are labelled and excluded from sums

    Then assert that no item row shares a carried-forward amount.

  4. 4

    Page numbers are non-decreasing

    A backwards jump means the pages were processed out of order or a row was attributed to the wrong page.

  5. 5

    Row count matches any stated count

    Many statements and packing lists print "12 items" somewhere. Capture it and compare.

  6. 6

    Balances chain, or the sum matches the total

    One end-to-end arithmetic proof per document; if it fails, review the whole document rather than one row.

Terminology bridge

This is table continuation handling, and the verification step is control totals

Research and vendor documentation call the underlying problem multi-page table structure recognition or table continuation; accountants call the verification control totals or a proof. Both halves matter: continuation handling is what gets the rows out correctly, and control totals are how you know it worked without reading the document yourself.

  • table continuation
  • multi-page table extraction
  • control totals
  • reconciliation
  • proof of totals

Follow-up questions

Is one 12-page document cheaper than 12 one-page requests?+
In credits, yes: One credit covers a document of up to 5 pages, and a document consumes one more credit per additional 5 pages. Self-serve plans stop at 50 pages per document. A 12-page document is 3 credits in one call, whereas 12 separate one-page calls would consume 12. It is also more accurate, because the extractor can see the continuation.
What if my documents are longer than the page limit?+
Self-serve plans reject documents over 50 pages with a 413 and refund the reserved credit, so nothing is silently truncated. Longer documents are handled on Enterprise, where the page ceiling follows the organisation's configured contract limit.
Can I ask for the page number of every row?+
You can define a page field and the extractor will populate it, but treat it as a model-produced value like any other — verify that page numbers are non-decreasing rather than assuming they are authoritative.

Evidence notes

Sources and limitations

Sources used

Limitations

  • Row-level page numbers and row types are extracted values, not metadata from the file. Verify them; do not trust them.
  • Reconciliation depends on the document printing a control total. Documents that print none can only be verified by sampling.
  • Self-serve extraction is capped at 50 pages per document; beyond that the request is rejected rather than truncated.

Published and last reviewed September 1, 2026. Product behavior can change; the linked API, pricing, and security pages are the controlling public references.

Send the whole statement, not page one

One call, one array of rows, then run the verifier above. The free plan includes 25 credits a month and 2 schemas, with no card required, which is enough to test this on your own documents before deciding anything.