PDF kit command
comment.add
Add a comment
Add a comment. Geometry is in points with the origin at the top-left of the displayed page, y down (as in page.render images at 72 dpi and text.find rects). note: `at` [x, y] (icon top-left). stamp: `at` [x, y] (its centre) and `stamp`: approved, completed, confidential, draft, final, for comment, for public release, information only, not approved, not for public release, preliminary results, void, accepted, initial here, rejected, sign here, witness; dynamic: true for the dynamic approved/confidential/received/reviewed/revised stamps with a By … at … line. highlight/underline/strikeout/squiggly: `find` (text on the page to mark; every match with all: true) or `quads`. rectangle/oval/textbox: `rect` [x0, y0, x1, y1]. line/arrow: `from`, `to`. Optional `endings` (two names: start, end) for a line, arrow or polyline, or one name for a callout: None, Square, Circle, Diamond, OpenArrow, ClosedArrow, Butt, ROpenArrow, RClosedArrow, Slash. An arrow without endings is None then OpenArrow. ink: `strokes` [[[x, y], …], …]. polygon/cloud/polyline (connected lines): `points` [[x, y], …]. callout: `rect` (its text box), `to` (the point the arrow touches), optional `knee` (where the leader bends before it runs into the side of the box facing it; outside the box, else placed for you). caret (inserted text): `at`, the insertion point on the baseline. replace (Replace Text): `find` or `quads` like highlight, `contents` the replacement. attachment: `path` (the file), `at`, optional `icon` (PushPin, Paperclip, Graph, Tag). Undoable.
- Kit
- PDF 0.1.0 (.pdf)
- Changes the document
- yes
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
all | boolean | no | Mark every match of `find` on the page, not just the first. |
at | number[] | no | [x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2) |
author | string | no | |
color | string | no | #RRGGBB or a name: yellow, red, orange, green, blue, purple, pink, black, gray, white. |
contents | string | no | The comment text (what a text box shows). |
dynamic | boolean | no | |
endings | ("None" | "Square" | "Circle" | "Diamond" | "OpenArrow" | "ClosedArrow" | "Butt" | "ROpenArrow" | "RClosedArrow" | "Slash")[] | no | Line endings. Two names (start, end) for a line, arrow or polyline; one name for a callout. (maxItems 2, minItems 1) |
fill | string | no | #RRGGBB or a name: yellow, red, orange, green, blue, purple, pink, black, gray, white. |
find | string | no | Text on the page to mark up (case-insensitive). |
fontSize | number | no | |
from | number[] | no | [x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2) |
icon | string | no | note: Comment, Note, Help, Insert, Key, NewParagraph, Paragraph; attachment: PushPin, Paperclip, Graph, Tag. |
knee | number[] | no | [x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2) |
opacity | number | no | (maximum 1, minimum 0) |
page | integer | yes | (minimum 1) |
points | number[][] | no | (minItems 2) |
quads | number[][] | no | |
rect | number[] | no | (maxItems 4, minItems 4) |
stamp | string | no | |
strokes | number[][][] | no | |
to | number[] | no | [x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2) |
type | "note" | "highlight" | "underline" | "strikeout" | "squiggly" | "replace" | "rectangle" | "oval" | "line" | "arrow" | "ink" | "textbox" | "stamp" | "polygon" | "cloud" | "polyline" | "callout" | "caret" | "attachment" | yes | |
width | number | no | Line width in points. (minimum 0) |
Call through pdf_run
pdf_run {
"path": "<file>.pdf",
"steps": [{ "command": "comment.add", "params": { "page": <integer>, "type": <"note" | "highlight" | "underline" | "strikeout" | "squiggly" | "replace" | "rectangle" | "oval" | "line" | "arrow" | "ink" | "textbox" | "stamp" | "polygon" | "cloud" | "polyline" | "callout" | "caret" | "attachment"> } }]
}The required parameters, with placeholders for their types: not a tested example. Optional: all, at, author, color, contents, dynamic, endings, fill, find, fontSize, from, icon, knee, opacity, points, quads, rect, stamp, strokes, to, width. pdf_run answers the step’s result in completed[i].result.
Result
The kit gives no result schema for this command.
Parameter schema
{
"additionalProperties": false,
"properties": {
"all": {
"description": "Mark every match of `find` on the page, not just the first.",
"type": "boolean"
},
"at": {
"description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"author": {
"type": "string"
},
"color": {
"description": "#RRGGBB or a name: yellow, red, orange, green, blue, purple, pink, black, gray, white.",
"type": "string"
},
"contents": {
"description": "The comment text (what a text box shows).",
"type": "string"
},
"dynamic": {
"type": "boolean"
},
"endings": {
"description": "Line endings. Two names (start, end) for a line, arrow or polyline; one name for a callout. (maxItems 2, minItems 1)",
"items": {
"enum": [
"None",
"Square",
"Circle",
"Diamond",
"OpenArrow",
"ClosedArrow",
"Butt",
"ROpenArrow",
"RClosedArrow",
"Slash"
],
"type": "string"
},
"type": "array"
},
"fill": {
"description": "#RRGGBB or a name: yellow, red, orange, green, blue, purple, pink, black, gray, white.",
"type": "string"
},
"find": {
"description": "Text on the page to mark up (case-insensitive).",
"type": "string"
},
"fontSize": {
"type": "number"
},
"from": {
"description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"icon": {
"description": "note: Comment, Note, Help, Insert, Key, NewParagraph, Paragraph; attachment: PushPin, Paperclip, Graph, Tag.",
"type": "string"
},
"knee": {
"description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"opacity": {
"description": "(maximum 1, minimum 0)",
"type": "number"
},
"page": {
"description": "(minimum 1)",
"type": "integer"
},
"points": {
"description": "(minItems 2)",
"items": {
"description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
"quads": {
"items": {
"description": "(maxItems 8, minItems 8)",
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
"rect": {
"description": "(maxItems 4, minItems 4)",
"items": {
"type": "number"
},
"type": "array"
},
"stamp": {
"type": "string"
},
"strokes": {
"items": {
"items": {
"description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
"type": "array"
},
"to": {
"description": "[x, y] in points from the top-left of the displayed page. (maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"type": {
"enum": [
"note",
"highlight",
"underline",
"strikeout",
"squiggly",
"replace",
"rectangle",
"oval",
"line",
"arrow",
"ink",
"textbox",
"stamp",
"polygon",
"cloud",
"polyline",
"callout",
"caret",
"attachment"
],
"type": "string"
},
"width": {
"description": "Line width in points. (minimum 0)",
"type": "number"
}
},
"required": [
"page",
"type"
],
"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.