PDF kit command

measure.setSnap

Snap a measurement vertex

Snap a point to vector paths, endpoints, midpoints or intersections. Coordinates and tolerance are in display points. Bounded extraction reports truncated geometry.

Kit
PDF 0.1.0 (.pdf)
Changes the document
no

Parameters

Parameters of measure.setSnap
NameTypeRequiredDescription
atnumber[]yes[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)
endpointsbooleanno
intersectionsbooleanno
midpointsbooleanno
pageintegeryes(minimum 1)
tolerancenumberno(maximum 10000, minimum 0)

Call through pdf_run

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

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

Result

Result of measure.setSnap
NameTypeRequiredDescription
intersection_limitedbooleanno
segmentsnumberno
snapobjectno
truncatedbooleanno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "intersection_limited": {
      "type": "boolean"
    },
    "segments": {
      "type": "number"
    },
    "snap": {
      "additionalProperties": true,
      "properties": {
        "distance": {
          "type": "number"
        },
        "kind": {
          "type": "string"
        },
        "point": {
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "truncated": {
      "type": "boolean"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "at": {
      "description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "endpoints": {
      "type": "boolean"
    },
    "intersections": {
      "type": "boolean"
    },
    "midpoints": {
      "type": "boolean"
    },
    "page": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "tolerance": {
      "description": "(maximum 10000, minimum 0)",
      "type": "number"
    }
  },
  "required": [
    "at",
    "page"
  ],
  "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.