PDF kit command
file.protect
Protect with passwords
Encrypt the document (applied by the next doc_save, a full rewrite). openPassword is needed to open it. permissionsPassword is needed to change security and lifts the restrictions given by printing/changes/copy/accessibility; those restrictions (and their defaults) apply only when permissionsPassword is given. With openPassword alone the document is encrypted and everything stays allowed, so passing a restriction without permissionsPassword is an error. Passwords are never echoed back. Undoable.
- Kit
- PDF 0.1.0 (.pdf)
- Changes the document
- yes
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
accessibility | boolean | no | Allow screen readers to read the text (needs permissionsPassword; default true). |
changes | "none" | "pages" | "fill-sign" | "comment-fill-sign" | "any-except-extract" | no | Needs permissionsPassword. Default none. |
compatibility | "aes-256" | "aes-128" | "rc4-128" | "rc4-40" | no | Default aes-256 (Acrobat X and later). |
copy | boolean | no | Allow copying text and images (needs permissionsPassword; default false). |
encryptMetadata | boolean | no | Default true. |
openPassword | string | no | Required to open the document. On its own it restricts nothing. (minLength 1) |
permissionsPassword | string | no | Required to change security; enables printing/changes/copy/accessibility and their defaults. (minLength 1) |
printing | "none" | "low" | "high" | no | Needs permissionsPassword. Default high. |
Call through pdf_run
pdf_run {
"path": "<file>.pdf",
"steps": [{ "command": "file.protect" }]
}The required parameters, with placeholders for their types: not a tested example. Optional: accessibility, changes, compatibility, copy, encryptMetadata, openPassword, permissionsPassword, printing. 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": {
"accessibility": {
"description": "Allow screen readers to read the text (needs permissionsPassword; default true).",
"type": "boolean"
},
"changes": {
"description": "Needs permissionsPassword. Default none.",
"enum": [
"none",
"pages",
"fill-sign",
"comment-fill-sign",
"any-except-extract"
],
"type": "string"
},
"compatibility": {
"description": "Default aes-256 (Acrobat X and later).",
"enum": [
"aes-256",
"aes-128",
"rc4-128",
"rc4-40"
],
"type": "string"
},
"copy": {
"description": "Allow copying text and images (needs permissionsPassword; default false).",
"type": "boolean"
},
"encryptMetadata": {
"description": "Default true.",
"type": "boolean"
},
"openPassword": {
"description": "Required to open the document. On its own it restricts nothing. (minLength 1)",
"type": "string"
},
"permissionsPassword": {
"description": "Required to change security; enables printing/changes/copy/accessibility and their defaults. (minLength 1)",
"type": "string"
},
"printing": {
"description": "Needs permissionsPassword. Default high.",
"enum": [
"none",
"low",
"high"
],
"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.