---
title: "file.export: Export — Note kit command — Kition"
description: "Writes the note as a standalone HTML file (the reading view with its stylesheet; `standalone: false` only the `<main>` element) or prints it to a PDF on `letter` or `a4` pages, and answers the file as base64 `data` with its size, a file name and, for a PDF, its page count and what the pages could not draw. Does not change the note."
canonical: "https://developer.kition.ai/docs/kits/note/commands/file.export"
---

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

# file.export

**Export.** Writes the note as a standalone HTML file (the reading view with its stylesheet; `standalone: false` only the `<main>` element) or prints it to a PDF on `letter` or `a4` pages, and answers the file as base64 `data` with its size, a file name and, for a PDF, its page count and what the pages could not draw. Does not change the note.

- Kit: Note 0.3.0 (Markdown (.md)); reference: [Note kit commands](https://developer.kition.ai/docs/kits/note.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | `"html" \| "pdf"` | yes | The file's format. |
| `pageSize` | `"letter" \| "a4"` | no | PDF: the page size. |
| `standalone` | `boolean` | no | HTML: a whole file with its stylesheet; false writes the <main> element only. |

## Call through note_run

```text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "file.export", "params": { "format": <"html" | "pdf"> } }]
}
```

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

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bytes` | `integer` | yes | Its size in bytes. |
| `data` | `string` | yes | The file's bytes, base64. |
| `format` | `"html" \| "pdf"` | yes | The format written. |
| `mime` | `"text/html" \| "application/pdf"` | yes | Its media type. |
| `name` | `string` | yes | A file name for it: the note's, ending in .html or .pdf. |
| `pages` | `integer` | no | A PDF's page count. |
| `unsupported` | `object` | no | What the pages could not draw as the editor shows it. |

```json
{
  "additionalProperties": false,
  "properties": {
    "bytes": {
      "description": "Its size in bytes.",
      "type": "integer"
    },
    "data": {
      "description": "The file's bytes, base64.",
      "type": "string"
    },
    "format": {
      "description": "The format written.",
      "enum": [
        "html",
        "pdf"
      ],
      "type": "string"
    },
    "mime": {
      "description": "Its media type.",
      "enum": [
        "text/html",
        "application/pdf"
      ],
      "type": "string"
    },
    "name": {
      "description": "A file name for it: the note's, ending in .html or .pdf.",
      "type": "string"
    },
    "pages": {
      "description": "A PDF's page count.",
      "type": "integer"
    },
    "unsupported": {
      "additionalProperties": false,
      "description": "What the pages could not draw as the editor shows it.",
      "properties": {
        "embeds": {
          "description": "Embeds drawn as labelled boxes.",
          "type": "integer"
        },
        "html": {
          "description": "HTML blocks drawn as their source.",
          "type": "integer"
        },
        "images": {
          "description": "Images drawn as labelled boxes.",
          "type": "integer"
        },
        "math": {
          "description": "Math drawn as its source.",
          "type": "integer"
        },
        "mermaid": {
          "description": "Mermaid diagrams drawn as their source.",
          "type": "integer"
        },
        "missingGlyphs": {
          "description": "Characters drawn as boxes: no page font has them.",
          "type": "integer"
        },
        "missingSample": {
          "description": "Up to 24 of those characters, in order of first use.",
          "type": "string"
        }
      },
      "required": [
        "embeds",
        "html",
        "images",
        "math",
        "mermaid",
        "missingGlyphs",
        "missingSample"
      ],
      "type": "object"
    }
  },
  "required": [
    "bytes",
    "data",
    "format",
    "mime",
    "name"
  ],
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "format": {
      "description": "The file's format.",
      "enum": [
        "html",
        "pdf"
      ],
      "type": "string"
    },
    "pageSize": {
      "default": "letter",
      "description": "PDF: the page size.",
      "enum": [
        "letter",
        "a4"
      ],
      "type": "string"
    },
    "standalone": {
      "default": true,
      "description": "HTML: a whole file with its stylesheet; false writes the <main> element only.",
      "type": "boolean"
    }
  },
  "required": [
    "format"
  ],
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/note.ts and the kit itself (kition-note@69e14d9).
