PDF kit command

redaction.mark

Mark for redaction

Mark content for redaction (nothing is removed until redaction.apply). One of: rect [x0, y0, x1, y1] (points from the top-left of the displayed page) with page; quads (selected text: one mark over its lines, each [x1, y1, x2, y2, x3, y3, x4, y4], the corners upper-left, upper-right, lower-left, lower-right in the same space, as text.select answers its rects and comment.add takes quads) with page; find (text, every match); words (a list of words or phrases, every match of each; the result's matched_words says how many marks each made); pattern (phone, email, credit-card, ssn, date: every match, the Search & Redact patterns); wholePages: true. find, words, pattern and wholePages work on pages (default all). overlay: text shown on the box once applied, or codeSet (foia: U.S. FOIA (b)(1)(A)…(b)(9); privacy-act: U.S. Privacy Act (d)(5), (j)(1)…(k)(7)) with codes, shown as "(b)(6), (b)(7)(C)"; fill: box colour (default black). Undoable.

Kit
PDF 0.1.0 (.pdf)
Changes the document
yes

Parameters

Parameters of redaction.mark
NameTypeRequiredDescription
authorstringno
codeSet"foia" | "privacy-act"no
codesstring[]noRedaction codes from codeSet, e.g. ["(b)(6)"]. (minItems 1)
fillstringno#RRGGBB or a colour name.
findstringno(minLength 1)
overlaystringno
pageintegerno(minimum 1)
pagesinteger[]no1-based page numbers to search or mark (default: all). (minItems 1)
pattern"phone" | "email" | "credit-card" | "ssn" | "date"no
quadsnumber[][]no(maxItems 4096, minItems 1)
rectnumber[]no(maxItems 4, minItems 4)
wholePagesbooleanno
wordsstring[]no(maxItems 1000, minItems 1)

Call through pdf_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: author, codeSet, codes, fill, find, overlay, page, pages, pattern, quads, rect, wholePages, words. 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": {
    "author": {
      "type": "string"
    },
    "codeSet": {
      "enum": [
        "foia",
        "privacy-act"
      ],
      "type": "string"
    },
    "codes": {
      "description": "Redaction codes from codeSet, e.g. [\"(b)(6)\"]. (minItems 1)",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "fill": {
      "description": "#RRGGBB or a colour name.",
      "type": "string"
    },
    "find": {
      "description": "(minLength 1)",
      "type": "string"
    },
    "overlay": {
      "type": "string"
    },
    "page": {
      "description": "(minimum 1)",
      "type": "integer"
    },
    "pages": {
      "description": "1-based page numbers to search or mark (default: all). (minItems 1)",
      "items": {
        "description": "(minimum 1)",
        "type": "integer"
      },
      "type": "array"
    },
    "pattern": {
      "enum": [
        "phone",
        "email",
        "credit-card",
        "ssn",
        "date"
      ],
      "type": "string"
    },
    "quads": {
      "description": "(maxItems 4096, minItems 1)",
      "items": {
        "description": "(maxItems 8, minItems 8)",
        "items": {
          "type": "number"
        },
        "type": "array"
      },
      "type": "array"
    },
    "rect": {
      "description": "(maxItems 4, minItems 4)",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "wholePages": {
      "type": "boolean"
    },
    "words": {
      "description": "(maxItems 1000, minItems 1)",
      "items": {
        "description": "(minLength 1)",
        "type": "string"
      },
      "type": "array"
    }
  },
  "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.