---
title: "file.export: Export — Doc kit command — Kition"
description: "Answers the document as a PDF, or one page (1-based) as a PNG image at a scale in pixels per point, as base64 for the host to write as a new file; nothing is written and the document does not change."
canonical: "https://developer.kition.ai/docs/kits/doc/commands/file.export"
---

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

# file.export

**Export.** Answers the document as a PDF, or one page (1-based) as a PNG image at a scale in pixels per point, as base64 for the host to write as a new file; nothing is written and the document does not change.

- Kit: Doc 0.1.0 (.docx); reference: [Doc kit commands](https://developer.kition.ai/docs/kits/doc.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | `"pdf" \| "png"` | no |  |
| `page` | `integer` | no | 1-based, PNG; 1 by default |
| `scale` | `any` | no | px per pt (PNG, 0.1 to 8; 2 by default); PNG, 0.1 to 8; 2 by default |

## Call through doc_run

```text
doc_run {
  "path": "<file>.docx",
  "steps": [{ "command": "file.export" }]
}
```

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

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bytes` | `number` | no |  |
| `data` | `string` | no | The file's bytes, base64 |
| `extension` | `string` | no |  |
| `format` | `"pdf" \| "png"` | no |  |
| `height` | `number` | no | PNG only: pixels |
| `mime` | `string` | no |  |
| `width` | `number` | no | PNG only: pixels |

```json
{
  "additionalProperties": false,
  "properties": {
    "bytes": {
      "type": "number"
    },
    "data": {
      "description": "The file's bytes, base64",
      "type": "string"
    },
    "extension": {
      "type": "string"
    },
    "format": {
      "enum": [
        "pdf",
        "png"
      ],
      "type": "string"
    },
    "height": {
      "description": "PNG only: pixels",
      "type": "number"
    },
    "mime": {
      "type": "string"
    },
    "width": {
      "description": "PNG only: pixels",
      "type": "number"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "format": {
      "enum": [
        "pdf",
        "png"
      ],
      "type": "string"
    },
    "page": {
      "description": "1-based, PNG; 1 by default",
      "type": "integer"
    },
    "scale": {
      "description": "px per pt (PNG, 0.1 to 8; 2 by default); PNG, 0.1 to 8; 2 by default"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/doc-darwin-arm64@0.1.0 and the kit itself (doc_commands through @kition/cli@0.1.1, built from KitionAI/kition-doc@41e14a8).
