Engineering Journal
Pdf Processor
Pdf Processor

How to Classify PDF Tables by Their Borders (and Why It Matters): LATTICE vs STREAM

2026-05-15

TLDR

PDF tables fall into two distinct architectural classes: LATTICE_TABLE (explicit vector grid lines) and STREAM_TABLE (borderless column alignment implied by text $X$-coordinates). Running standard grid cell expansion (colspan/rowspan) on borderless stream tables collapses all cells into a single full-page spanning cell. Setting isBorderless = true disables expansion loops, while distinct CSS wrapper classes (.pdf-table--lattice vs .pdf-table--borderless) preserve semantic rendering.
Table ArchitectureDetection EvidenceGrid Line Inputcolspan/rowspan ExpansionCSS Styling Class
LATTICE_TABLEVector Path Segments$H/V$ Grid LinesEnabled (Full expansion).pdf-table--lattice (Borders)
STREAM_TABLESpatial $X$-ClusteringhLines: [], vLines: []Disabled (isBorderless = true).pdf-table--borderless (Clean)

Technical implementation & overlap guard

// Table Builder: Disable colspan/rowspan expansion for borderless stream tables
export function buildTableHtmlGrid(latticeGridData) {
  const isBorderless = latticeGridData.hLines.length === 0 && latticeGridData.vLines.length === 0;

if (isBorderless) { // Stream tables skip expansion logic: assign explicit 1x1 cells return renderBorderlessTableHtml(latticeGridData.cells); }

// Lattice tables execute full grid expansion return renderLatticeTableHtml(expandCellSpans(latticeGridData)); }

// Overlap Guard: Prefer physical vector lattice tables over stream heuristics export function resolveTableClassification(latticeTables, streamTables) { const finalTables = [...latticeTables];

for (const streamTable of streamTables) { const overlapCoverage = calculateItemCoverage(streamTable, latticeTables); // Skip stream table if 80%+ of items are already claimed by a physical lattice grid if (overlapCoverage > 0.8) continue; finalTables.push(streamTable); }

return finalTables; }

Rule of thumb: Disable colspan/rowspan expansion for borderless stream tables (isBorderless = true) and prioritize vector lattice grids when classifications overlap.
Read this post in the full Engineering Journal →