Board kit command

file.export

Export

Draws the shown page (or `page`, or one frame) as PNG, SVG or PDF and answers the file as base64 without changing the board.

Kit
Board 0.1.0 (.kboard)
Changes the document
no

Parameters

Parameters of file.export
NameTypeRequiredDescription
backgroundbooleannoA white page behind the board (true by default; PDF pages are always white)
fitbooleannoA PNG too large at its scale is drawn at the largest scale that fits instead of refused
format"png" | "svg" | "pdf"yesThe file to write
framestringnoOne frame and what is in it, instead of the whole page
pagestringnoThe page's id; the shown page when absent
scalenumber (≥ 0.1, ≤ 8)noPNG pixels per board unit, 0.1 to 8 (2 by default)

Call through board_run

text
board_run {
  "path": "<file>.kboard",
  "steps": [{ "command": "file.export", "params": { "format": <"png" | "svg" | "pdf"> } }]
}

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

Result

Result of file.export
NameTypeRequiredDescription
base64stringyesThe file's bytes
extensionstringyes
format"png" | "svg" | "pdf"yes
heightnumberyes
mimestringyes
widthnumberyes
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "base64": {
      "description": "The file's bytes",
      "type": "string"
    },
    "extension": {
      "type": "string"
    },
    "format": {
      "enum": [
        "png",
        "svg",
        "pdf"
      ],
      "type": "string"
    },
    "height": {
      "type": "number"
    },
    "mime": {
      "type": "string"
    },
    "width": {
      "type": "number"
    }
  },
  "required": [
    "base64",
    "extension",
    "format",
    "height",
    "mime",
    "width"
  ],
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "background": {
      "description": "A white page behind the board (true by default; PDF pages are always white)",
      "type": "boolean"
    },
    "fit": {
      "description": "A PNG too large at its scale is drawn at the largest scale that fits instead of refused",
      "type": "boolean"
    },
    "format": {
      "description": "The file to write",
      "enum": [
        "png",
        "svg",
        "pdf"
      ],
      "type": "string"
    },
    "frame": {
      "description": "One frame and what is in it, instead of the whole page",
      "type": "string",
      "x-khp-types": [
        "Element"
      ]
    },
    "page": {
      "description": "The page's id; the shown page when absent",
      "type": "string",
      "x-khp-types": [
        "Page"
      ]
    },
    "scale": {
      "description": "PNG pixels per board unit, 0.1 to 8 (2 by default)",
      "maximum": 8,
      "minimum": 0.1,
      "type": "number"
    }
  },
  "required": [
    "format"
  ],
  "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.