Design kit command

file.render

Render preview

Draws a view of the design as a PNG preview, a function of the design and the call alone: a page by id or number, a layer, a frame or an area of a page, framed to it; without a target the first page. Never the current page, the selection or the view, and never a change. Use it to look at the result of an edit.

Kit
Design 0.1.0 (.kdesign)
Changes the document
no

Parameters

Parameters of file.render
NameTypeRequiredDescription
commandsany[]noread by the command beside its listed parameters
idinteger | stringnoread by the command beside its listed parameters
maxSizeintegernoThe most pixels on the longer side, 1 to 4096; default 2048. A larger view is drawn at a smaller scale.
pageintegernoThe page to draw, counted from 1.
scalenumbernoDevice pixels per canvas unit, above 0 and up to 2; default 1.
slideintegernoThe page to draw, counted from 0 (what hosts send for one part of a document).
targetobjectnoThe view: a page (`pageId`, or `page` counted from 1), a layer (`objectId`, or a diagnostic's `path` `layer:<id>`), a frame (`frame`), or an `area` of a page; a layer names its page. Without one, the first page.

Call through design_run

text
design_run {
  "path": "<file>.kdesign",
  "steps": [{ "command": "file.render" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: commands, id, maxSize, page, scale, slide, target. design_run answers the step’s result in completed[i].result.

Result

Result of file.render
NameTypeRequiredDescription
boundsobjectno
heightnumberno
mimeTypestringno
pagenumberno
pngstringno
scalenumberno
widthnumberno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "bounds": {
      "additionalProperties": true,
      "properties": {
        "height": {
          "type": "number"
        },
        "width": {
          "type": "number"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "height": {
      "type": "number"
    },
    "mimeType": {
      "type": "string"
    },
    "page": {
      "type": "number"
    },
    "png": {
      "type": "string"
    },
    "scale": {
      "type": "number"
    },
    "width": {
      "type": "number"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "commands": {
      "description": "read by the command beside its listed parameters",
      "type": "array"
    },
    "id": {
      "description": "read by the command beside its listed parameters",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ]
    },
    "maxSize": {
      "description": "The most pixels on the longer side, 1 to 4096; default 2048. A larger view is drawn at a smaller scale.",
      "type": "integer"
    },
    "page": {
      "description": "The page to draw, counted from 1.",
      "type": "integer"
    },
    "scale": {
      "description": "Device pixels per canvas unit, above 0 and up to 2; default 1.",
      "type": "number"
    },
    "slide": {
      "description": "The page to draw, counted from 0 (what hosts send for one part of a document).",
      "type": "integer"
    },
    "target": {
      "additionalProperties": false,
      "description": "The view: a page (`pageId`, or `page` counted from 1), a layer (`objectId`, or a diagnostic's `path` `layer:<id>`), a frame (`frame`), or an `area` of a page; a layer names its page. Without one, the first page.",
      "properties": {
        "area": {
          "additionalProperties": false,
          "description": "An area in page coordinates {x, y, width, height}, on the page named (the first without one).",
          "properties": {
            "height": {
              "type": "number"
            },
            "width": {
              "type": "number"
            },
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            }
          },
          "type": "object"
        },
        "frame": {
          "description": "A frame's (or section's, or component's) id.",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-role": "object",
          "x-khp-types": [
            "Node"
          ]
        },
        "objectId": {
          "description": "A layer's id: that layer where it is on its page.",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-role": "object",
          "x-khp-types": [
            "Node"
          ]
        },
        "page": {
          "description": "A page counted from 1, as diagnostics give it.",
          "type": "integer"
        },
        "pageId": {
          "description": "A page's id, as inspect lists it.",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-role": "object",
          "x-khp-types": [
            "Node"
          ]
        },
        "path": {
          "description": "A diagnostic's target, `layer:<id>`.",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "returns": "{png (base64), mimeType, width, height, scale, page, pageId, pageName, drew, objectId, bounds}",
  "type": "object"
}

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