Layout kit command

file.exportBytes

Export as Bytes

Answers the document as a PDF, PNG, JPEG, HTML, IDML or EPUB file in base64 without writing it; the host writes it as a new file.

Kit
Layout 0.1.0 (.klayout)
Changes the document
no

Parameters

Parameters of file.exportBytes
NameTypeRequiredDescription
authoranyno
background"paper" | "transparent"noPNG
bleedbooleanno
compressImagesbooleannoPDF: images as JPEG
coverbooleannoEPUB
embedImagesbooleannoIDML
fixedLayoutbooleannoEPUB
format"pdf" | "png" | "jpg" | "html" | "idml" | "epub"no
languageanyno
marksanynobool | {crop?: bool, bleed?: bool, pageInfo?: bool} (PDF printer's marks); PDF printer's marks
pagesanyno"1-3,5" | [1,3] (PDF, PNG, JPEG: 1-based; pictures default to the first page); PDF, PNG, JPEG: 1-based; pictures default to the first page
ppiintegernoPNG, JPEG
qualityintegerno1 to 100; JPEG
spreadsbooleannoPDF: each spread on one sheet
standard"none" | "x4" | "a2b"noPDF/X-4, PDF/A-2b
taggedbooleannoPDF
titlestringno

Call through layout_run

text
layout_run {
  "path": "<file>.klayout",
  "steps": [{ "command": "file.exportBytes" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: author, background, bleed, compressImages, cover, embedImages, fixedLayout, format, language, marks, pages, ppi, quality, spreads, standard, tagged, title. layout_run answers the step’s result in completed[i].result.

Result

Result of file.exportBytes
NameTypeRequiredDescription
bytesnumberno
datastringno
filesobject[]no
formatstringno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "bytes": {
      "type": "number"
    },
    "data": {
      "type": "string"
    },
    "files": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "data": {
            "type": "string"
          },
          "page": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "format": {
      "type": "string"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "author": {},
    "background": {
      "description": "PNG",
      "enum": [
        "paper",
        "transparent"
      ],
      "type": "string"
    },
    "bleed": {
      "type": "boolean"
    },
    "compressImages": {
      "description": "PDF: images as JPEG",
      "type": "boolean"
    },
    "cover": {
      "description": "EPUB",
      "type": "boolean"
    },
    "embedImages": {
      "description": "IDML",
      "type": "boolean"
    },
    "fixedLayout": {
      "description": "EPUB",
      "type": "boolean"
    },
    "format": {
      "enum": [
        "pdf",
        "png",
        "jpg",
        "html",
        "idml",
        "epub"
      ],
      "type": "string"
    },
    "language": {},
    "marks": {
      "description": "bool | {crop?: bool, bleed?: bool, pageInfo?: bool} (PDF printer's marks); PDF printer's marks"
    },
    "pages": {
      "description": "\"1-3,5\" | [1,3] (PDF, PNG, JPEG: 1-based; pictures default to the first page); PDF, PNG, JPEG: 1-based; pictures default to the first page"
    },
    "ppi": {
      "default": 72,
      "description": "PNG, JPEG",
      "type": "integer"
    },
    "quality": {
      "description": "1 to 100; JPEG",
      "type": "integer"
    },
    "spreads": {
      "description": "PDF: each spread on one sheet",
      "type": "boolean"
    },
    "standard": {
      "description": "PDF/X-4, PDF/A-2b",
      "enum": [
        "none",
        "x4",
        "a2b"
      ],
      "type": "string"
    },
    "tagged": {
      "description": "PDF",
      "type": "boolean"
    },
    "title": {
      "type": "string"
    }
  },
  "returns": "{format, data, bytes, files?: [{page, data}] (pictures of several pages)}",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (layout_commands through @kition/[email protected], built from KitionAI/kition-layout@8767a18). As data: commands.jsonl.