Skip to main content
Spatial commands query document content based on physical position on a page. Find nodes within a bounding box region or list all bounding boxes on a page.

Subcommands

CommandDescription
spatial findFind nodes within a bounding box region
spatial bboxList bounding boxes for nodes on a page

Spatial Find

Find content nodes within a rectangular region on a specific page.
kdx document spatial find <file.kddb> --page N --region x1,y1,x2,y2 [flags]

Flags

FlagDescriptionDefault
--page NPage number (1-based, required)
--region x1,y1,x2,y2Region coordinates (required)
--typeFilter by node type
--tagFilter by tag name
--max NMaximum results0 (unlimited)
--prettyPretty-print JSON outputfalse

Example

kdx document spatial find doc.kddb --page 1 --region 0,0,300,100 --type line
{"nodeId":15,"type":"line","content":"Invoice Number: INV-2024-001","page":1,"bbox":{"x1":72,"y1":50,"x2":280,"y2":62}}
{"nodeId":16,"type":"line","content":"Date: January 15, 2024","page":1,"bbox":{"x1":72,"y1":65,"x2":250,"y2":77}}

Spatial Bbox

List all bounding boxes on a page, useful for understanding page layout.
kdx document spatial bbox <file.kddb> --page N [flags]

Flags

FlagDescriptionDefault
--page NPage number (1-based, required)
--typeFilter by node type
--prettyPretty-print JSON outputfalse

Example

kdx document spatial bbox doc.kddb --page 1 --type line --pretty
{
  "nodeId": 15,
  "type": "line",
  "content": "Invoice Number: INV-2024-001",
  "x1": 72.0,
  "y1": 50.0,
  "x2": 280.0,
  "y2": 62.0
}
Use spatial find to extract content from specific regions of a page, such as headers, footers, or specific form fields.
Use spatial bbox to understand the layout of a page before targeting specific regions with spatial find.