PDF kit command

form.setProps

Field properties

Change field properties: give field for one field, or fields for a list of unique field names (1–1000). A bulk change is atomic and one Undo step; an invalid or locked field leaves every field unchanged. Only the given properties change, and partial appearance changes preserve each field's other colours and font. name (rename), rect (position) and rotation require a single field. General and Options: tooltip, readOnly, required, multiline, maxLength (0 = no limit), options (combo/list items), fontSize (0 = auto), format, validate, calculate (the standard AF rules). Options: align (left, center, right), default (Reset form's value; check boxes/radio buttons use their on state, "" for off), flags { scroll, rich_text, password, file_select, spell_check, comb (needs maxLength), sort, editable, multi_select, commit_immediately }, checkStyle (check boxes/radio buttons: check, circle, cross, diamond, square, star). rotation is 0, 90, 180 or 270 degrees counterclockwise and swaps width/height when the axis changes. Undoable.

Kit
PDF 0.1.0 (.pdf)
Changes the document
yes

Parameters

Parameters of form.setProps
NameTypeRequiredDescription
align"left" | "center" | "right"no
appearanceobjectnoAppearance tab: border, fill, text_color (#RRGGBB, a name or "none"), width (0–12 points; 1 thin, 2 medium, 3 thick), style (solid, dashed, beveled, inset, underline), font (helvetica, times, courier).
calculateobject | "none"noCalculate tab: {"op": "sum"|"product"|"average"|"min"|"max", "fields": ["a", "b"]}, {"notation": "Price * Qty"} (simplified field notation), or "none".
checkStyle"check" | "circle" | "cross" | "diamond" | "square" | "star"noCheck boxes and radio buttons: the mark shown when on.
defaultstringno
fieldstringnoThe field's current name.
fieldsstring[]noApply the same changes to these fields in one atomic edit. Use either field or fields. (maxItems 1000, minItems 1)
flagsobjectno
fontSizenumberno(minimum 0)
formatobject | "none"noFormat tab: {"type": "number", "decimals": 2, "currency": "$", "separator": 0-4, "negative": 0-3}, {"type": "percent"}, {"type": "date"|"time", "pattern": "mm/dd/yyyy"}, {"type": "zip"|"zip4"|"phone"|"ssn"}, {"type": "mask", "mask": "AA-9999"}, or "none".
lockedbooleannoLock the field's properties (only unlocking is accepted while locked).
maxLengthintegerno(minimum 0)
multilinebooleanno
namestringno
optionsstring[]no
readOnlybooleanno
rectnumber[]noMove/resize: points from the top-left of the displayed page. (maxItems 4, minItems 4)
requiredbooleanno
rotation0 | 90 | 180 | 270noWidget rotation in degrees, counterclockwise. Changing between horizontal and vertical swaps the rectangle around its center.
tooltipstringno
validateobject | "none"noValidate tab: {"min": 0, "max": 100} (either may be left out) or "none".

Call through pdf_run

text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "form.setProps" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: align, appearance, calculate, checkStyle, default, field, fields, flags, fontSize, format, locked, maxLength, multiline, name, options, readOnly, rect, required, rotation, tooltip, validate. 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": {
    "align": {
      "enum": [
        "left",
        "center",
        "right"
      ],
      "type": "string"
    },
    "appearance": {
      "additionalProperties": true,
      "description": "Appearance tab: border, fill, text_color (#RRGGBB, a name or \"none\"), width (0–12 points; 1 thin, 2 medium, 3 thick), style (solid, dashed, beveled, inset, underline), font (helvetica, times, courier).",
      "type": "object"
    },
    "calculate": {
      "description": "Calculate tab: {\"op\": \"sum\"|\"product\"|\"average\"|\"min\"|\"max\", \"fields\": [\"a\", \"b\"]}, {\"notation\": \"Price * Qty\"} (simplified field notation), or \"none\".",
      "oneOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "enum": [
            "none"
          ],
          "type": "string"
        }
      ]
    },
    "checkStyle": {
      "description": "Check boxes and radio buttons: the mark shown when on.",
      "enum": [
        "check",
        "circle",
        "cross",
        "diamond",
        "square",
        "star"
      ],
      "type": "string"
    },
    "default": {
      "type": "string"
    },
    "field": {
      "description": "The field's current name.",
      "type": "string"
    },
    "fields": {
      "description": "Apply the same changes to these fields in one atomic edit. Use either field or fields. (maxItems 1000, minItems 1)",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "flags": {
      "additionalProperties": true,
      "type": "object"
    },
    "fontSize": {
      "description": "(minimum 0)",
      "type": "number"
    },
    "format": {
      "description": "Format tab: {\"type\": \"number\", \"decimals\": 2, \"currency\": \"$\", \"separator\": 0-4, \"negative\": 0-3}, {\"type\": \"percent\"}, {\"type\": \"date\"|\"time\", \"pattern\": \"mm/dd/yyyy\"}, {\"type\": \"zip\"|\"zip4\"|\"phone\"|\"ssn\"}, {\"type\": \"mask\", \"mask\": \"AA-9999\"}, or \"none\".",
      "oneOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "enum": [
            "none"
          ],
          "type": "string"
        }
      ]
    },
    "locked": {
      "description": "Lock the field's properties (only unlocking is accepted while locked).",
      "type": "boolean"
    },
    "maxLength": {
      "description": "(minimum 0)",
      "type": "integer"
    },
    "multiline": {
      "type": "boolean"
    },
    "name": {
      "type": "string"
    },
    "options": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "readOnly": {
      "type": "boolean"
    },
    "rect": {
      "description": "Move/resize: points from the top-left of the displayed page. (maxItems 4, minItems 4)",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "required": {
      "type": "boolean"
    },
    "rotation": {
      "description": "Widget rotation in degrees, counterclockwise. Changing between horizontal and vertical swaps the rectangle around its center.",
      "enum": [
        0,
        90,
        180,
        270
      ],
      "type": "integer"
    },
    "tooltip": {
      "type": "string"
    },
    "validate": {
      "description": "Validate tab: {\"min\": 0, \"max\": 100} (either may be left out) or \"none\".",
      "oneOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "enum": [
            "none"
          ],
          "type": "string"
        }
      ]
    }
  },
  "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.