PDF kit command

form.addField

Prepare form: add a field

Add a form field on a page. type: text, date, checkbox, radio, combo, list, button, image (a picture placeholder; fill it with form_set_image), signature. rect in points from the top-left of the displayed page [x0, y0, x1, y1]. name defaults to the next free name (Text1, Check Box1, Group1, Dropdown1, List Box1, Button1, Image1, Signature1, Date1). Radio buttons join the radio group named by group (a new group otherwise) with the export value export. Returns the field's name. Undoable.

Kit
PDF 0.1.0 (.pdf)
Changes the document
yes

Parameters

Parameters of form.addField
NameTypeRequiredDescription
captionstringnoButton label.
editablebooleannoCombo box accepts typed text.
exportstringnoRadio button export value (default Choice1).
groupstringnoRadio group to join.
multiSelectbooleanno
multilinebooleanno
namestringno
optionsstring[]noCombo box / list box items.
pageintegeryes(minimum 1)
rectnumber[]yes(maxItems 4, minItems 4)
type"text" | "date" | "checkbox" | "radio" | "combo" | "list" | "button" | "image" | "signature"yes

Call through pdf_run

text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "form.addField", "params": { "page": <integer>, "rect": <number[]>, "type": <"text" | "date" | "checkbox" | "radio" | "combo" | "list" | "button" | "image" | "signature"> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: caption, editable, export, group, multiSelect, multiline, name, options. pdf_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "caption": {
      "description": "Button label.",
      "type": "string"
    },
    "editable": {
      "description": "Combo box accepts typed text.",
      "type": "boolean"
    },
    "export": {
      "description": "Radio button export value (default Choice1).",
      "type": "string"
    },
    "group": {
      "description": "Radio group to join.",
      "type": "string"
    },
    "multiSelect": {
      "type": "boolean"
    },
    "multiline": {
      "type": "boolean"
    },
    "name": {
      "type": "string"
    },
    "options": {
      "description": "Combo box / list box items.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "page": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "rect": {
      "description": "(maxItems 4, minItems 4)",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "type": {
      "enum": [
        "text",
        "date",
        "checkbox",
        "radio",
        "combo",
        "list",
        "button",
        "image",
        "signature"
      ],
      "type": "string"
    }
  },
  "required": [
    "page",
    "rect",
    "type"
  ],
  "type": "object"
}

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