PDF kit command
measure.setScale
Set or read a measurement scale
Read the scale at a point, or add a rectangular viewport using unitsPerPoint or two calibration points and their real-world distance. Existing measurements retain their original scales. Undoable.
- Kit
- PDF 0.1.0 (.pdf)
- Changes the document
- yes
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
at | number[] | no | [x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2) |
distance | number | no | |
name | string | no | |
page | integer | yes | (minimum 1) |
points | number[][] | no | (maxItems 2048, minItems 1) |
precision | integer | no | (maximum 6, minimum 0) |
rect | number[] | no | (maxItems 4, minItems 4) |
unit | string | no | |
unitsPerPoint | number | no |
Call through pdf_run
text
pdf_run {
"path": "<file>.pdf",
"steps": [{ "command": "measure.setScale", "params": { "page": <integer> } }]
}The required parameters, with placeholders for their types: not a tested example. Optional: at, distance, name, points, precision, rect, unit, unitsPerPoint. pdf_run answers the step’s result in completed[i].result.
Result
The kit gives no result schema for this command.
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"
},
"distance": {
"type": "number"
},
"name": {
"type": "string"
},
"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"
},
"precision": {
"description": "(maximum 6, minimum 0)",
"type": "integer"
},
"rect": {
"description": "(maxItems 4, minItems 4)",
"items": {
"type": "number"
},
"type": "array"
},
"unit": {
"type": "string"
},
"unitsPerPoint": {
"type": "number"
}
},
"required": [
"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.