Vector kit command

file.exportBytes

Export to Data

Answers the document, its selection or chosen artboards as a file in a format (SVG, PDF, PNG, JPEG, TIFF, PSD, DXF, EPS and more) with file.export's options, as base64 `data` (with `files` when the format writes one file per artboard), without writing a file or changing the document: the host writes it.

Kit
Vector 0.1.0 (.kvector)
Changes the document
no

Parameters

Parameters of file.exportBytes
NameTypeRequiredDescription
allbooleanno1-based; PDF writes one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard; one of several alternative parameters
antiAlias"none" | "art" | "type"nodefault; raster; type: text snapped to pixels
artboardintegerno
artboardsany[]no
backgroundstringno
byteOrder"little" | "big"notiff
colorModel"rgb" | "cmyk" | "gray"nojpg, tiff, psd; bmp: rgb|gray; tiff: rgb keeps transparency as an alpha channel
colorsintegernogif and png8: 2–256
depthintegernobmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha; tga: 16 one-bit alpha, 24, 32 with alpha
dither"none" | "diffusion" | "pattern" | "noise"nodefault; gif and png8
ditherAmountintegernogif and png8
embedIccbooleannojpg, tiff, psd
encoding"utf8" | "utf16"notxt, the stories in stacking order, back to front, a thread once: utf16 with a byte order mark; also an SVG option
fileFormat"windows" | "os2"nobmp: 1, 4, 8 or 24 bits
flipRowsbooleannobmp: top-down rows
format"svg" | "svgz" | "pdf" | "png" | "jpg" | "webp" | "gif" | "png8" | "txt" | "dxf" | "eps" | "emf" | "wmf" | "tiff" | "bmp" | "tga" | "psd" | "kvector" | "template"nodefault: from the path's extension, else png; png8 writes an indexed .png
hiddenLayersbooleannopsd: hidden layers and objects written hidden instead of left out; also an SVG option
imageMap"none" | "client" | "server"nojpg: an HTML or NCSA map of the objects with a URL, written as <stem>.html / <stem>.map
interlacedbooleanno
layersbooleannopsd: each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white
lineEndings"lf" | "crlf"notxt
losslessbooleannowebp: lossy WebP isn't available yet: written lossless, with a warning
lzwbooleannotiff
mattestringno
maxEditabilitybooleannopsd: layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer
method"baseline" | "optimized" | "progressive"nojpg
ppinumbernoraster: pixels per inch, stored in the file; wins over scale
qualityintegernojpg: 0–100; webp: for when lossy WebP is available
rangestringnolike 1-3, 5; one of several alternative parameters
reduction"perceptual" | "selective" | "adaptive" | "web" | "blackWhite" | "gray"nodefault; gif and png8
rlebooleannobmp: 4 and 8 bits, windows
scalenumbernoraster: pixels per point
scansintegernojpg: 3–5, progressive
selectedOnlybooleannothe selected objects alone, in their layers
selectionOnlybooleanno
svgobjectnostyling, outlineText, images, objectIds, decimals, minify, responsive, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts: see file.formats; SVG options flat or in svg
transparencybooleannogif and png8
useArtboards"true" | "false"noraster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf: every page; emf/wmf: one file per chosen artboard; pdf/raster/emf/wmf: the bounds of the visible art; SVG has it as an SVG option

Call through vector_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: all, antiAlias, artboard, artboards, background, byteOrder, colorModel, colors, depth, dither, ditherAmount, embedIcc, encoding, fileFormat, flipRows, format, hiddenLayers, imageMap, interlaced, layers, lineEndings, lossless, lzw, matte, maxEditability, method, ppi, quality, range, reduction, rle, scale, scans, selectedOnly, selectionOnly, svg, transparency, useArtboards. vector_run answers the step’s result in completed[i].result.

Result

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

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "all": {
      "description": "1-based; PDF writes one page per artboard, default all; SVG writes one file per artboard, {stem}-{artboard}.svg; raster formats write one artboard; one of several alternative parameters",
      "type": "boolean"
    },
    "antiAlias": {
      "description": "default; raster; type: text snapped to pixels",
      "enum": [
        "none",
        "art",
        "type"
      ],
      "type": "string"
    },
    "artboard": {
      "default": 0,
      "type": "integer"
    },
    "artboards": {
      "type": "array"
    },
    "background": {
      "type": "string"
    },
    "byteOrder": {
      "description": "tiff",
      "enum": [
        "little",
        "big"
      ],
      "type": "string"
    },
    "colorModel": {
      "description": "jpg, tiff, psd; bmp: rgb|gray; tiff: rgb keeps transparency as an alpha channel",
      "enum": [
        "rgb",
        "cmyk",
        "gray"
      ],
      "type": "string"
    },
    "colors": {
      "default": 256,
      "description": "gif and png8: 2–256",
      "type": "integer"
    },
    "depth": {
      "default": 24,
      "description": "bmp: 1 black and white, 4|8 a palette by reduction and dither, 16, 24, 32 with alpha; tga: 16 one-bit alpha, 24, 32 with alpha",
      "type": "integer"
    },
    "dither": {
      "description": "default; gif and png8",
      "enum": [
        "none",
        "diffusion",
        "pattern",
        "noise"
      ],
      "type": "string"
    },
    "ditherAmount": {
      "default": 100,
      "description": "gif and png8",
      "type": "integer"
    },
    "embedIcc": {
      "default": true,
      "description": "jpg, tiff, psd",
      "type": "boolean"
    },
    "encoding": {
      "description": "txt, the stories in stacking order, back to front, a thread once: utf16 with a byte order mark; also an SVG option",
      "enum": [
        "utf8",
        "utf16"
      ],
      "type": "string"
    },
    "fileFormat": {
      "description": "bmp: 1, 4, 8 or 24 bits",
      "enum": [
        "windows",
        "os2"
      ],
      "type": "string"
    },
    "flipRows": {
      "default": false,
      "description": "bmp: top-down rows",
      "type": "boolean"
    },
    "format": {
      "description": "default: from the path's extension, else png; png8 writes an indexed .png",
      "enum": [
        "svg",
        "svgz",
        "pdf",
        "png",
        "jpg",
        "webp",
        "gif",
        "png8",
        "txt",
        "dxf",
        "eps",
        "emf",
        "wmf",
        "tiff",
        "bmp",
        "tga",
        "psd",
        "kvector",
        "template"
      ],
      "type": "string"
    },
    "hiddenLayers": {
      "default": false,
      "description": "psd: hidden layers and objects written hidden instead of left out; also an SVG option",
      "type": "boolean"
    },
    "imageMap": {
      "description": "jpg: an HTML or NCSA map of the objects with a URL, written as <stem>.html / <stem>.map",
      "enum": [
        "none",
        "client",
        "server"
      ],
      "type": "string"
    },
    "interlaced": {
      "type": "boolean"
    },
    "layers": {
      "default": true,
      "description": "psd: each top-level layer a pixel layer with its opacity and blend mode; a background colour is a Background layer; false: one flat image, on white",
      "type": "boolean"
    },
    "lineEndings": {
      "description": "txt",
      "enum": [
        "lf",
        "crlf"
      ],
      "type": "string"
    },
    "lossless": {
      "default": true,
      "description": "webp: lossy WebP isn't available yet: written lossless, with a warning",
      "type": "boolean"
    },
    "lzw": {
      "default": true,
      "description": "tiff",
      "type": "boolean"
    },
    "matte": {
      "type": "string"
    },
    "maxEditability": {
      "default": false,
      "description": "psd: layers and sublayers become groups, each object a layer named as in the Layers panel, text by its text; clipping, masked or knockout layers stay one layer",
      "type": "boolean"
    },
    "method": {
      "description": "jpg",
      "enum": [
        "baseline",
        "optimized",
        "progressive"
      ],
      "type": "string"
    },
    "ppi": {
      "default": 72,
      "description": "raster: pixels per inch, stored in the file; wins over scale",
      "type": "number"
    },
    "quality": {
      "default": 90,
      "description": "jpg: 0–100; webp: for when lossy WebP is available",
      "type": "integer"
    },
    "range": {
      "description": "like 1-3, 5; one of several alternative parameters",
      "type": "string"
    },
    "reduction": {
      "description": "default; gif and png8",
      "enum": [
        "perceptual",
        "selective",
        "adaptive",
        "web",
        "blackWhite",
        "gray"
      ],
      "type": "string"
    },
    "rle": {
      "default": false,
      "description": "bmp: 4 and 8 bits, windows",
      "type": "boolean"
    },
    "scale": {
      "default": 1,
      "description": "raster: pixels per point",
      "type": "number"
    },
    "scans": {
      "default": 3,
      "description": "jpg: 3–5, progressive",
      "type": "integer"
    },
    "selectedOnly": {
      "default": false,
      "description": "the selected objects alone, in their layers",
      "type": "boolean"
    },
    "selectionOnly": {
      "type": "boolean"
    },
    "svg": {
      "additionalProperties": true,
      "description": "styling, outlineText, images, objectIds, decimals, minify, responsive, useArtboards, preserveEditing, metadata, fewerTspans, hiddenLayers, encoding, profile, embedFonts: see file.formats; SVG options flat or in svg",
      "type": "object"
    },
    "transparency": {
      "default": true,
      "description": "gif and png8",
      "type": "boolean"
    },
    "useArtboards": {
      "description": "raster: one file per chosen artboard, default all, {stem}-{artboard}.{ext}; pdf: every page; emf/wmf: one file per chosen artboard; pdf/raster/emf/wmf: the bounds of the visible art; SVG has it as an SVG option",
      "enum": [
        "true",
        "false"
      ],
      "type": "string"
    }
  },
  "returns": "{data (the file, base64; the first when the format writes several), format, bytes, warnings, files?: [{name, data}] (several), linked?: [{name, data}]}. Never changes the document",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (vector_commands through @kition/[email protected], built from KitionAI/kition-vector@7cf908f). As data: commands.jsonl.