PDF kit command
page.addText
Add text to a page
Add text as page content (not a comment). Place it with at [x, y] (top-left, points from the top-left of the displayed page) and width (wrap width, default 200), or rect. Newlines start new lines; long lines wrap. Style: font helvetica/times/courier or a document font by family (kition-fonts, or one the host added, such as Lora), size, bold, italic, color (#RRGGBB or a name), align left/center/right. Characters the standard fonts lack (Chinese, Japanese) are drawn from a document font that has them; the standard families are drawn from Arimo, Tinos and Cousine when the host added them, so the page embeds every font it uses. It stays editable with content.set. Undoable.
- Kit
- PDF 0.1.0 (.pdf)
- Changes the document
- yes
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
align | "left" | "center" | "right" | "justify" | no | |
at | number[] | no | (maxItems 2, minItems 2) |
bold | boolean | no | |
color | string | no | |
font | "helvetica" | "times" | "courier" | no | |
italic | boolean | no | |
page | integer | yes | (minimum 1) |
rect | number[] | no | (maxItems 4, minItems 4) |
size | number | no | (maximum 500, minimum 1) |
text | string | yes | (minLength 1) |
width | number | no |
Call through pdf_run
pdf_run {
"path": "<file>.pdf",
"steps": [{ "command": "page.addText", "params": { "page": <integer>, "text": <string> } }]
}The required parameters, with placeholders for their types: not a tested example. Optional: align, at, bold, color, font, italic, rect, size, 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": {
"align": {
"enum": [
"left",
"center",
"right",
"justify"
],
"type": "string"
},
"at": {
"description": "(maxItems 2, minItems 2)",
"items": {
"type": "number"
},
"type": "array"
},
"bold": {
"type": "boolean"
},
"color": {
"type": "string"
},
"font": {
"enum": [
"helvetica",
"times",
"courier"
],
"type": "string"
},
"italic": {
"type": "boolean"
},
"page": {
"description": "(minimum 1)",
"type": "integer"
},
"rect": {
"description": "(maxItems 4, minItems 4)",
"items": {
"type": "number"
},
"type": "array"
},
"size": {
"description": "(maximum 500, minimum 1)",
"type": "number"
},
"text": {
"description": "(minLength 1)",
"type": "string"
},
"width": {
"type": "number"
}
},
"required": [
"page",
"text"
],
"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.