Why this matters
- The leave entitlement grid in PolicyDesk's PDF spans two pages. A text dump merged the last row of page one with the header of page two, and casual leave inherited privilege leave's day count.
- Tables are where exact facts live: rates, eligibility, limits. Prose chunking is the wrong tool.
- Interviewers ask two related questions: how you parse a table, and how you stitch one that crosses a page break.
- A beautiful embedding of a broken grid is still a broken grid.
What goes wrong
Large tables in reports, invoices, and policy PDFs do not fit on one page. The header repeats, or it does not. A row splits. A cell merges across columns. A footer ("continued on next page") lands in the middle of the data if you extract text in reading order.
You need the grid: column names, row order, and cell values, plus the caption and the section title that say what the grid is about. A list of numbers without headers is not answerable. "8" does not mean anything until you know it is casual leave for confirmed employees.
The structural facts
- Headers may repeat on each page, or appear only on the first page. Both happen.
- Column count and column meaning should stay stable across the break. If they change, you may be looking at a new table, not a continuation.
- The last row on page N can be unfinished and continue as the first row on page N+1.
- Merged cells, multi-line cells, and missing borders are normal in real PDFs and rare in tutorials.
- Row order is part of the meaning. Sorting the extracted strings alphabetically destroys it.
A pipeline
Stages
- Detect. Find table regions on each page using rules (lines, alignment) or a detector model. Remember the page number and the bounding box.
- Parse. Produce rows, columns, and header cells. Record merged spans so a value is not repeated or dropped.
- Link. Decide that the grid on page 6 continues the grid on page 5, rather than starting a new one.
- Clean. Drop repeated headers from the data rows, drop "continued" footers, and fill a split row.
- Serialize. Write markdown, CSV, or JSON that a model can read. Attach the caption, section title, and source page range.
- Index. Embed a chunk that includes the headers. Store table id, page range, and schema in metadata.
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 4 sections
- Stitching pages
- Making chunks the model can use
- Two pages, one grid
- What you gain, and what remains hard
Test yourself
Answer these before moving on — recall is what makes it stick.