---
title: "file.render: Render preview — Design kit command — Kition"
description: "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."
canonical: "https://developer.kition.ai/docs/kits/design/commands/file.render"
---

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

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

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `commands` | `any[]` | no | read by the command beside its listed parameters |
| `id` | `integer \| string` | no | read by the command beside its listed parameters |
| `maxSize` | `integer` | no | The most pixels on the longer side, 1 to 4096; default 2048. A larger view is drawn at a smaller scale. |
| `page` | `integer` | no | The page to draw, counted from 1. |
| `scale` | `number` | no | Device pixels per canvas unit, above 0 and up to 2; default 1. |
| `slide` | `integer` | no | The page to draw, counted from 0 (what hosts send for one part of a document). |
| `target` | `object` | no | 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. |

## 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

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bounds` | `object` | no |  |
| `height` | `number` | no |  |
| `mimeType` | `string` | no |  |
| `page` | `number` | no |  |
| `png` | `string` | no |  |
| `scale` | `number` | no |  |
| `width` | `number` | no |  |

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