Browser PDF Layout Analysis: Column Detection and Vector Shapes
How to run spatial PDF layout analysis, detect multi-column text baselines, lattice tables, and vector path shapes in JavaScript.
TLDR
Developers building PDF document parsers need to separate multi-column text baselines, lattice grid tables, stream whitespace tables, and closed vector shapes. Relying on raw character streams fails because PDFs store unordered text fragments pined to coordinates. GINEXYS PDF Processor analyzePanel.js exposes spatial threshold controls (Y-band, paragraph gap, column gap, stream confidence) to visually inspect and tune document layout analysis in real time.
The Search Query: PDF Layout Analysis and Column Detection
Developers frequently search for:
- "browser pdf layout analyzer detect multi column text javascript"
- "pdf lattice table vs stream table detection algorithm"
- "extract vector shapes and text baselines from pdf pdf.js"
Understanding Layout Detection Parameters
PDF Processor categorizes document geometry using four interactive threshold parameters:
| Parameter Key | UI Slider | Default Value | Functional Role |
|---|---|---|---|
R_Y_BAND | Y-Band Tol | 0.30 | Grouping text fragments into horizontal baseline rows |
R_PARA_GAP | Para Gap | 1.20 | Threshold distance to split text rows into separate paragraphs |
R_COL_GAP_MIN | Col Gap Min | 1.50 | Minimum gutter width to separate parallel vertical columns |
STREAM_CONFIDENCE | Stream Conf | 0.60 | Score threshold required to classify whitespace alignment as a table |
Tuning Bipartite Column Splitter in Code
When a document features dense multi-column layouts, you can tune R_COL_GAP_MIN and place manual column splits directly on the canvas:
// Manual column split placement in analyzePanel.js
function _addManualSplit(colX) {
if (!_manualSplits.has(_currentPage)) {
_manualSplits.set(_currentPage, []);
}
_manualSplits.get(_currentPage).push(colX);
_redrawCanvas(); // Redraws split guide line
}
Rule of thumb: adjust Y-band tolerance when analyzing rotated or non-standard font baselines to avoid line fragmentation.
Interactive Bounding Box Keyboard Shortcuts
When inspecting region classification in analyzePanel.js, select any region bounding box and use these hotkeys to override classification:
[Hotkey Reference]
L -> Convert to LATTICE_TABLE
S -> Convert to STREAM_TABLE
P -> Convert to PARAGRAPH
H -> Convert to HEADING
B -> Convert to BOX
I -> Convert to IMAGE
D -> Convert to DIVIDER
F -> Convert to FOOTER
R -> Convert to HEADER
Delete / Backspace -> Mark region as skipped (fall-through extraction)
Re-extracting Page with Custom Regions
Clicking Re-extract page posts custom regions and overrides to the background Web Worker:
// Re-extracting with manual overrides
worker.postMessage({
type: 'reprocess',
pageIndex: _currentPage,
customRegions: _customRegionsByPage.get(_currentPage + 1),
manualSplits: _manualSplits.get(_currentPage),
scaleOverrides: _scaleOverrides
});
Conclusion
Combining spatial geometry histograms with manual region override hotkeys guarantees 100% extraction accuracy across complex multi-column PDFs.
PDF Extractor — Pull text, tables, and vector geometry out of PDFs — in the browser, with no upload.