PDF kit command

image.edit

Edit an image

Change one of a page's images (number from page.listImages): action move (rect: new box in top-left-origin points), rotate (quarters clockwise, default 1), flip_horizontal, flip_vertical, replace (path: an image file, drawn in the same place) or delete. Undoable. Form artwork supports move/resize/rotate/flip/delete as a group; replace and image_save only support raster images.

Kit
PDF 0.1.0 (.pdf)
Changes the document
yes

Parameters

Parameters of image.edit
NameTypeRequiredDescription
action"move" | "rotate" | "flip_horizontal" | "flip_vertical" | "replace" | "delete"yes
imageintegeryes(minimum 1)
pageintegeryes(minimum 1)
quartersintegerno
rectnumber[]no(maxItems 4, minItems 4)

Call through pdf_run

text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "image.edit", "params": { "action": <"move" | "rotate" | "flip_horizontal" | "flip_vertical" | "replace" | "delete">, "image": <integer>, "page": <integer> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: quarters, rect. 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": {
    "action": {
      "enum": [
        "move",
        "rotate",
        "flip_horizontal",
        "flip_vertical",
        "replace",
        "delete"
      ],
      "type": "string"
    },
    "image": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "page": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "quarters": {
      "type": "integer"
    },
    "rect": {
      "description": "(maxItems 4, minItems 4)",
      "items": {
        "type": "number"
      },
      "type": "array"
    }
  },
  "required": [
    "action",
    "image",
    "page"
  ],
  "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.