Board kit command

file.render

Preview a view

Draws one view of the board as a PNG (a page, a frame, an element or an area, by id) for looking at it, without changing the board or the page the editor shows; the same call answers the same picture.

Kit
Board 0.1.0 (.kboard)
Changes the document
no

Parameters

Parameters of file.render
NameTypeRequiredDescription
maxSizeinteger (≥ 16, ≤ 8192)noThe longest side in pixels, 16 to 8192; the scale is brought down to fit
scalenumber (≤ 4)noPixels per board unit, more than 0 and at most 4 (1 by default)
targetobjectnoThe view to draw; without it the first page's document area. At most one of frame, objectId and area

Call through board_run

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

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

Result

Result of file.render
NameTypeRequiredDescription
areanumber[]yes[x0, y0, x1, y1]: what was drawn, in board units
framestringnoThe frame drawn, when the view named one
heightintegeryes
mimeTypestringyes
objectIdstringnoThe element drawn, when the view named one
pagestringyesThe id of the page drawn
pageNamestringyes
pngstringyesThe picture, base64
scalenumberyesPixels per board unit, after maxSize
widthintegeryes
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "area": {
      "description": "[x0, y0, x1, y1]: what was drawn, in board units",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "frame": {
      "description": "The frame drawn, when the view named one",
      "type": "string"
    },
    "height": {
      "type": "integer"
    },
    "mimeType": {
      "type": "string"
    },
    "objectId": {
      "description": "The element drawn, when the view named one",
      "type": "string"
    },
    "page": {
      "description": "The id of the page drawn",
      "type": "string"
    },
    "pageName": {
      "type": "string"
    },
    "png": {
      "description": "The picture, base64",
      "type": "string"
    },
    "scale": {
      "description": "Pixels per board unit, after maxSize",
      "type": "number"
    },
    "width": {
      "type": "integer"
    }
  },
  "required": [
    "area",
    "height",
    "mimeType",
    "page",
    "pageName",
    "png",
    "scale",
    "width"
  ],
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "maxSize": {
      "description": "The longest side in pixels, 16 to 8192; the scale is brought down to fit",
      "maximum": 8192,
      "minimum": 16,
      "type": "integer"
    },
    "scale": {
      "description": "Pixels per board unit, more than 0 and at most 4 (1 by default)",
      "maximum": 4,
      "type": "number"
    },
    "target": {
      "additionalProperties": false,
      "description": "The view to draw; without it the first page's document area. At most one of frame, objectId and area",
      "properties": {
        "area": {
          "description": "[x0, y0, x1, y1] in board units on the page",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        "frame": {
          "description": "A frame's id: its box",
          "type": "string",
          "x-khp-role": "object",
          "x-khp-types": [
            "Element"
          ]
        },
        "objectId": {
          "description": "An element's id: its bounds with a margin of 16 units",
          "type": "string",
          "x-khp-role": "object",
          "x-khp-types": [
            "Element"
          ]
        },
        "page": {
          "description": "The page's id (or its number counted from 1, as diagnostics give it); the first page when absent",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "minimum": 1,
              "type": "integer"
            }
          ],
          "x-khp-types": [
            "Page"
          ]
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}

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