Engineering Journal
Pdf Processor
Pdf Processor

The format won't label your figures: a postmortem

2026-07-03

TLDR

Relying on PDF renderer image events (OPS.paintImageXObject) only extracts raster graphics. Vector technical diagrams (wiring schematics, CAD exports) emit thousands of path construction operators that fall through to table detectors, corrupting table grids. Executing a pre-table figure classifier that identifies non-axis-aligned multi-segment free paths isolates vector diagrams, protecting table detection pools.
Graphics Content TypeRender Stream PrimitiveInitial Pipeline BucketCorrected Pipeline Bucket
Raster Photos & LogospaintImageXObjectImage BucketRaster Crop Engine
Vector Diagrams & CADPath operators (c, v, y)Table Evidence Pool (Defective)Vector Figure Classifier

Technical vector figure classifier

// Pre-table classifier isolating multi-segment vector figure paths
export function extractVectorFigureRegions(subpathOperators, viewportCanvas) {
  const figureSubpaths = subpathOperators.filter(subpath => {
    // Identify subpaths containing non-axis-aligned bezier curves or diagonal lines
    const isFreePath = subpath.segments.some(seg => seg.isBezier || seg.isDiagonal);
    return isFreePath && subpath.segments.length > 4;
  });

if (figureSubpaths.length === 0) return { figureRegions: [], remainingPaths: subpathOperators };

// Group vector subpaths spatially into bounding figure boxes const figureBounds = clusterSubpathsIntoBoundingBoxes(figureSubpaths); const figurePathSet = new Set(figureSubpaths);

// Return isolated figure regions and filter them out of table evidence const remainingPaths = subpathOperators.filter(path => !figurePathSet.has(path)); return { figureRegions: figureBounds, remainingPaths }; }

Rule of thumb: Filter untyped vector path streams for non-axis-aligned multi-segment subpaths before passing path data to table grid reconstructors.
Read this post in the full Engineering Journal →