---
title: "table.file.render: Render a preview image — Table kit command — Kition"
description: "Draws the table, a view, some of its rows, a field, one record's cell or a dashboard as the editor shows them, as a PNG at a scale up to 2, such as the target a diagnostic names; changes nothing."
canonical: "https://developer.kition.ai/docs/kits/table/commands/table.file.render"
---

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

# table.file.render

**Render a preview image.** Draws the table, a view, some of its rows, a field, one record's cell or a dashboard as the editor shows them, as a PNG at a scale up to 2, such as the target a diagnostic names; changes nothing.

- Kit: Table 0.4.0 (.ktable); reference: [Table kit commands](https://developer.kition.ai/docs/kits/table.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `maxSize` | `integer` | no | The longest side in pixels, 1 to 4096; default 4096. |
| `scale` | `number` | no | Device pixels per document pixel, above 0 and up to 2; default 1. |
| `slide` | `integer` | no | Without target: the table at this position among the tables, counted from 0 (a host's part preview). |
| `target` | `object` | no | What to draw: a table or a view by id (table, view), or a diagnostic's target as the check answered it. table is a table's id (its first view), view a view's id (the records it shows, filtered and in its order). path is tables/<id> (the table as the editor opens it), tables/<id>/views/<id> (a view, the records it shows), tables/<id>/fields/<id>, tables/<id>/records/<id> or tables/<id>/records/<id>/fields/<id> (every field and record of the table, that one outlined and the picture framed around it), or dashboards/<id>; sheet, a table's title, when there is no path. rows [from, to] draws only the records at those positions of the table or view, counted from 1 as the grid numbers them. Default: the first table's first view, whatever the editor shows. |

## Call through table_run

```text
table_run {
  "path": "<file>.ktable",
  "steps": [{ "command": "table.file.render" }]
}
```

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

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `object` | no | Why the call failed (A18); the file is as it was. |
| `height` | `integer` | no | Its height in pixels. |
| `mimeType` | `string` | no | image/png. |
| `png` | `string` | no | Base64 of the PNG. |
| `scale` | `number` | no | The scale it was drawn at. |
| `tableId` | `integer \| null` | no | The table drawn; null for a dashboard. |
| `viewId` | `integer \| null` | no | The view drawn; null without one. |
| `width` | `integer` | no | Its width in pixels. |

```json
{
  "additionalProperties": false,
  "properties": {
    "error": {
      "additionalProperties": false,
      "description": "Why the call failed (A18); the file is as it was.",
      "properties": {
        "code": {
          "enum": [
            "invalid-params",
            "invalid-op",
            "invalid-value",
            "not-found",
            "read-only",
            "unknown-command",
            "command-failed",
            "not-open",
            "draft-required",
            "not-allowed",
            "unsupported",
            "unavailable",
            "failed"
          ],
          "type": "string"
        },
        "index": {
          "description": "The failing step or operation.",
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "height": {
      "description": "Its height in pixels.",
      "type": "integer"
    },
    "mimeType": {
      "description": "image/png.",
      "type": "string"
    },
    "png": {
      "description": "Base64 of the PNG.",
      "type": "string"
    },
    "scale": {
      "description": "The scale it was drawn at.",
      "type": "number"
    },
    "tableId": {
      "description": "The table drawn; null for a dashboard.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "viewId": {
      "description": "The view drawn; null without one.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "width": {
      "description": "Its width in pixels.",
      "type": "integer"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "maxSize": {
      "description": "The longest side in pixels, 1 to 4096; default 4096.",
      "type": "integer"
    },
    "scale": {
      "description": "Device pixels per document pixel, above 0 and up to 2; default 1.",
      "type": "number"
    },
    "slide": {
      "description": "Without target: the table at this position among the tables, counted from 0 (a host's part preview).",
      "type": "integer"
    },
    "target": {
      "additionalProperties": false,
      "description": "What to draw: a table or a view by id (table, view), or a diagnostic's target as the check answered it. table is a table's id (its first view), view a view's id (the records it shows, filtered and in its order). path is tables/<id> (the table as the editor opens it), tables/<id>/views/<id> (a view, the records it shows), tables/<id>/fields/<id>, tables/<id>/records/<id> or tables/<id>/records/<id>/fields/<id> (every field and record of the table, that one outlined and the picture framed around it), or dashboards/<id>; sheet, a table's title, when there is no path. rows [from, to] draws only the records at those positions of the table or view, counted from 1 as the grid numbers them. Default: the first table's first view, whatever the editor shows.",
      "properties": {
        "path": {
          "description": "tables/<id>[/views/<id> | /fields/<id> | /records/<id>[/fields/<id>]] or dashboards/<id>, with the ids table_inspect answers.",
          "type": "string"
        },
        "rows": {
          "description": "[from, to]: the records at these positions, counted from 1, both included.",
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "sheet": {
          "description": "A table's title (a diagnostic gives it beside path).",
          "type": "string"
        },
        "table": {
          "description": "A table's id, as table_inspect lists it: the table as its first view shows it.",
          "type": "integer"
        },
        "view": {
          "description": "A view's id, as table_inspect lists it: the records it shows, in its order.",
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/table.ts and the kit itself (kition-table@ee73209).
