PDF kit command

file.setWatermark

Add watermark

Add a watermark to pages: text, or a picture from `file` (an image, or page `filePage` of a PDF) at `scale` of the page (default 0.5); rotated (degrees counter-clockwise, default 45), semi-transparent (opacity 0–1, default 0.5), text fitted to the page unless fontSize is given, on top unless behind: true. replace: true swaps out existing ones. Undoable.

Kit
PDF 0.1.0 (.pdf)
Changes the document
yes

Parameters

Parameters of file.setWatermark
NameTypeRequiredDescription
behindbooleanno
colorstringno
filePageintegerno(minimum 1)
fontSizenumberno
opacitynumberno(maximum 1, minimum 0)
pagesinteger[]no1-based page numbers to mark (default: all). (minItems 1)
replacebooleanno
rotationnumberno
scalenumberno(maximum 1)
textstringno(minLength 1)

Call through pdf_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: behind, color, filePage, fontSize, opacity, pages, replace, rotation, scale, text. 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": {
    "behind": {
      "type": "boolean"
    },
    "color": {
      "type": "string"
    },
    "filePage": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "fontSize": {
      "type": "number"
    },
    "opacity": {
      "description": "(maximum 1, minimum 0)",
      "type": "number"
    },
    "pages": {
      "description": "1-based page numbers to mark (default: all). (minItems 1)",
      "items": {
        "description": "(minimum 1)",
        "type": "integer"
      },
      "type": "array"
    },
    "replace": {
      "type": "boolean"
    },
    "rotation": {
      "type": "number"
    },
    "scale": {
      "description": "(maximum 1)",
      "type": "number"
    },
    "text": {
      "description": "(minLength 1)",
      "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.