PDF kit command

form.setScript

Set a field's JavaScript

Field Properties ▸ Run custom script: set field's JavaScript for event keystroke, format, validate or calculate (the field's actions; calculated fields join the calculation order) or mouse_up (a button's action). Omit script to remove it. The scripts use the Acrobat JavaScript object model (event.value, event.rc, getField, util.printf, …) and run when the field changes. Undoable.

Kit
PDF 0.1.0 (.pdf)
Changes the document
yes

Parameters

Parameters of form.setScript
NameTypeRequiredDescription
event"keystroke" | "format" | "validate" | "calculate" | "mouse_up"yes
fieldstringyes
scriptstringno

Call through pdf_run

text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "form.setScript", "params": { "event": <"keystroke" | "format" | "validate" | "calculate" | "mouse_up">, "field": <string> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: script. 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": {
    "event": {
      "enum": [
        "keystroke",
        "format",
        "validate",
        "calculate",
        "mouse_up"
      ],
      "type": "string"
    },
    "field": {
      "type": "string"
    },
    "script": {
      "type": "string"
    }
  },
  "required": [
    "event",
    "field"
  ],
  "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.