---
title: "file.render: Preview a view — Board kit command — Kition"
description: "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."
canonical: "https://developer.kition.ai/docs/kits/board/commands/file.render"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/board/commands/file.render](https://developer.kition.ai/docs/kits/board/commands/file.render)

# 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); reference: [Board kit commands](https://developer.kition.ai/docs/kits/board.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `maxSize` | `integer (≥ 16, ≤ 8192)` | no | The longest side in pixels, 16 to 8192; the scale is brought down to fit |
| `scale` | `number (≤ 4)` | no | Pixels per board unit, more than 0 and at most 4 (1 by default) |
| `target` | `object` | no | The 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

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `area` | `number[]` | yes | [x0, y0, x1, y1]: what was drawn, in board units |
| `frame` | `string` | no | The frame drawn, when the view named one |
| `height` | `integer` | yes |  |
| `mimeType` | `string` | yes |  |
| `objectId` | `string` | no | The element drawn, when the view named one |
| `page` | `string` | yes | The id of the page drawn |
| `pageName` | `string` | yes |  |
| `png` | `string` | yes | The picture, base64 |
| `scale` | `number` | yes | Pixels per board unit, after maxSize |
| `width` | `integer` | yes |  |

```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/board-darwin-arm64@0.1.0 and the kit itself (board_commands through @kition/cli@0.1.1, built from KitionAI/kition-board@e78c190).
