pdfcraft
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePdfCraft
PdfCraft
Operate PdfCraft through its structured automation interfaces. Preserve the user's requested document and editing workflow.
通过 PdfCraft 的结构化自动化接口进行操作。保留用户要求的文档处理和编辑工作流。
References
参考资料
PdfCraft documents automation in two bundled snapshots, captured from upstream on 2026-11-02:
- references/mcp.md — the MCP server: startup flags, tool surface, and file-access confinement. Source: PdfCraft MCP conventions.
- references/cli-batch.md — for convert, OCR, and optimize over files and folders. Source: PdfCraft batch docs.
pdfcraft-cli batch
Both are distributed under the bundled MIT license. Relative links inside the snapshots resolve against . The desktop control channel is described in the upstream README; discover installed commands and flags rather than borrowing schemas from other ArtCraft applications.
https://github.com/storytold/pdfcraft/blob/main/docs/PdfCraft 在两个随附的快照中记录了自动化功能,这些快照于 2026-11-02 从上游捕获:
- references/mcp.md——MCP 服务器:启动标志、工具接口和文件访问限制。来源:PdfCraft MCP conventions。
- references/cli-batch.md——用于批量转换、OCR 和优化文件及文件夹的 。来源:PdfCraft batch docs。
pdfcraft-cli batch
两者均依据随附的 MIT 许可证分发。快照中的相对链接基于 解析。桌面控制通道在上游 README中有详细说明;应发现已安装的命令和标志,而不是借用其他 ArtCraft 应用的 schema。
https://github.com/storytold/pdfcraft/blob/main/docs/Select the surface
选择操作接口
- MCP (headless, opt-in): runs over stdin/stdout JSON lines, opens no port, and stops on EOF. It always runs in its own process; it never attaches to the desktop app.
pdfcraft-cli mcp [--root DIR] [--compact] [--automation-read-root DIR] [--automation-write-root DIR] - Desktop control (live window): start to let an agent see and operate the real interface — widget tree, clicks, typing, keys, commands, screenshots. Off by default, loopback only, and every connection must present the random token in that file. Keep the control file in a folder only you can write (never
pdfcraft --control ~/.pdfcraft-control.json);/tmprefuses symlinked or world-readable control files. Drive it withpdfcraft-cli ui.pdfcraft-cli ui --control <file> inspect|click|key|command|drag|screenshot|resize|focus|quit - One-off file processing: (see the batch reference) and the CLI's other subcommands.
pdfcraft-cli batch
Discover available executables and sessions first and reuse a running session when possible. If the required connection or executable is missing, report the concrete prerequisite; this skill does not install PdfCraft or register MCP servers.
- MCP(无头、选择性启用): 通过 stdin/stdout JSON lines 运行,不开放端口,并在 EOF 时停止。它始终在独立进程中运行,绝不附着到桌面应用。
pdfcraft-cli mcp [--root DIR] [--compact] [--automation-read-root DIR] [--automation-write-root DIR] - 桌面控制(实时窗口): 启动 ,使 Agent 能够查看并操作真实界面,包括 widget 树、点击、输入、按键、命令和截图。该功能默认关闭,仅允许 loopback 连接,并且每次连接都必须提供该文件中的随机 token。将控制文件保存在只有你拥有写权限的文件夹中(绝不要放在
pdfcraft --control ~/.pdfcraft-control.json中);/tmp会拒绝使用符号链接或全局可读的控制文件。使用pdfcraft-cli ui进行操作。pdfcraft-cli ui --control <file> inspect|click|key|command|drag|screenshot|resize|focus|quit - 一次性文件处理: (参见批处理参考资料)以及 CLI 的其他子命令。
pdfcraft-cli batch
首先发现可用的可执行文件和会话,并在可能的情况下复用正在运行的会话。如果缺少所需的连接或可执行文件,请报告具体的前置条件;此 skill 不会安装 PdfCraft 或注册 MCP 服务器。
Tools and discovery
工具与发现
The MCP surface maps document work to five common tools: , , , , and ; existing task tools (, , , , , , …) remain available. and resources mirror and . Discover command ids and mapped tool schemas before running commands; unknown top-level MCP arguments are refused with JSON-RPC , and a failed batch reports per-step errors. Inspect the returned id after and pass it to dependent commands.
command_list {doc?, filter?, enabled_only?}command_run {id, params?}command_batch {steps, stop_on_error?}doc_inspect {doc?}render_preview {doc?, page?, max_side?}doc_opendoc_savepage_*form_*sign_*ocr_*pdfcraft://documentpdfcraft://commandsdoc_inspectcommand_list-32602docfile.openMCP 接口通过五个常用工具映射文档处理工作:、、、 和 ;现有任务工具(、、、、、 等)仍可使用。 和 资源分别对应 和 。运行命令前,应先发现命令 ID 和映射后的工具 schema;未知的顶层 MCP 参数会触发 JSON-RPC 错误而被拒绝,批处理失败时会报告各步骤的错误。执行 后,检查返回的 ID,并将其传递给依赖该 ID 的命令。
command_list {doc?, filter?, enabled_only?}command_run {id, params?}command_batch {steps, stop_on_error?}doc_inspect {doc?}render_preview {doc?, page?, max_side?}doc_opendoc_savepage_*form_*sign_*ocr_*pdfcraft://documentpdfcraft://commandsdoc_inspectcommand_list-32602file.opendocFile access and output
文件访问与输出
Read and write roots are separate launch-time capabilities: every file a tool reads must lie inside the read root and every file it writes inside the write root; a root left out grants none of that access. Paths are resolved (links followed) and compared by whole folder names; a refused path is an ordinary, correctable tool error — do not bypass it with ambient filesystem commands. confines everything and can be combined with the automation roots (both must accept the path). Keychain or certificate-store signing identities and printer jobs are not file access and are not covered.
--rootExports complete synchronously; there is no background progress or cancellation. Save the requested deliverable (edited PDF in place or to a new path) and verify outputs exist and render: re-open or the saved file and the pages that matter, checking text, annotations, form fields, and page order. For batches, read the JSON report and surface skipped files and per-file errors.
doc_inspectrender_preview读写根目录是彼此独立的启动时权限:工具读取的每个文件都必须位于读根目录内,工具写入的每个文件都必须位于写根目录内;未指定某个根目录即不授予对应的访问权限。路径会被解析(跟随链接),并按完整文件夹名称进行比较;路径被拒绝属于普通且可纠正的工具错误——不要使用环境文件系统命令绕过限制。 会限制所有访问,并可与自动化根目录结合使用(两者都必须接受该路径)。钥匙串或证书存储中的签名身份以及打印任务不属于文件访问,因此不在此限制范围内。
--root导出操作会同步完成;不提供后台进度或取消机制。保存要求的交付物(原地编辑 PDF 或保存到新路径),并验证输出文件存在且能够渲染:重新打开保存的文件或使用 检查,并使用 预览相关页面,检查文本、批注、表单字段和页面顺序。对于批处理任务,应读取 JSON 报告,并呈现被跳过的文件和每个文件的错误。
doc_inspectrender_preview