PDF kit command

measure.getInfo

Read a measurement

Calculate a live distance, perimeter or area, deltas, angle and scale without adding an annotation. Incomplete paths are allowed.

Kit
PDF 0.1.0 (.pdf)
Changes the document
no

Parameters

Parameters of measure.getInfo
NameTypeRequiredDescription
pageintegeryes(minimum 1)
pointsnumber[][]yes(maxItems 2048, minItems 1)
type"distance" | "perimeter" | "area"no

Call through pdf_run

text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "measure.getInfo", "params": { "page": <integer>, "points": <number[][]> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: type. pdf_run answers the step’s result in completed[i].result.

Result

Result of measure.getInfo
NameTypeRequiredDescription
readingobjectno
scaleobjectno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "reading": {
      "additionalProperties": true,
      "properties": {
        "angle": {
          "type": "number"
        },
        "area": {
          "type": "number"
        },
        "delta_x": {
          "type": "number"
        },
        "delta_y": {
          "type": "number"
        },
        "kind": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "length": {
          "type": "number"
        },
        "unit": {
          "type": "string"
        },
        "value": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "scale": {
      "additionalProperties": true,
      "properties": {
        "area_factor": {
          "type": "number"
        },
        "area_unit": {
          "type": "string"
        },
        "distance_factor": {
          "type": "number"
        },
        "precision": {
          "type": "number"
        },
        "ratio": {
          "type": "string"
        },
        "unit": {
          "type": "string"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "page": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "points": {
      "description": "(maxItems 2048, minItems 1)",
      "items": {
        "description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
        "items": {
          "type": "number"
        },
        "type": "array"
      },
      "type": "array"
    },
    "type": {
      "enum": [
        "distance",
        "perimeter",
        "area"
      ],
      "type": "string"
    }
  },
  "required": [
    "page",
    "points"
  ],
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (pdf_commands through @kition/[email protected], built from KitionAI/kition-pdf@b0d2725). As data: commands.jsonl.