Doc kit command

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)
Changes the document
no

Parameters

Parameters of file.export
NameTypeRequiredDescription
format"pdf" | "png"no
pageintegerno1-based, PNG; 1 by default
scaleanynopx 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

Result of file.export
NameTypeRequiredDescription
bytesnumberno
datastringnoThe file's bytes, base64
extensionstringno
format"pdf" | "png"no
heightnumbernoPNG only: pixels
mimestringno
widthnumbernoPNG only: pixels
Result JSON Schema
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/[email protected] and the kit itself (doc_commands through @kition/[email protected], built from KitionAI/kition-doc@41e14a8). As data: commands.jsonl.