← 返回 Skills 市场
odrobnik

Printer

作者 Oliver Drobnik · GitHub ↗ · v1.2.2
cross-platform ✓ 安全检测通过
783
总下载
0
收藏
3
当前安装
9
版本数
在 OpenClaw 中安装
/install cups-printer
功能描述
Print images and PDFs to any CUPS printer. PPD-aware: reads paper sizes, margins, resolution, and duplex at runtime. Use when the user wants to print files (...
使用说明 (SKILL.md)

Printer

Print images and PDF files to any CUPS printer. All settings (paper size, margins, resolution, duplex) are read from the printer's PPD file at runtime.

Entry point: {baseDir}/scripts/print.py

Setup

See SETUP.md for prerequisites and platform notes.

Commands

List Printers

python3 {baseDir}/scripts/print.py list
python3 {baseDir}/scripts/print.py list --json

Shows available printers with status and which is the system default.

Print a File

python3 {baseDir}/scripts/print.py print /path/to/file.pdf
python3 {baseDir}/scripts/print.py print /path/to/image.png
python3 {baseDir}/scripts/print.py print /path/to/file.pdf --printer "Custom_Printer"
python3 {baseDir}/scripts/print.py print /path/to/file.pdf -o InputSlot=tray-2
python3 {baseDir}/scripts/print.py print /path/to/file.pdf -o cupsPrintQuality=High -o sides=one-sided
python3 {baseDir}/scripts/print.py print /path/to/file.pdf --json
  • PDFs: Sent directly to the printer with correct media/duplex settings
  • Images (PNG, JPG, GIF, BMP, TIFF, WebP): Converted to PDF at the printer's native DPI, centered within the printable area, then printed
  • -o KEY=VALUE: Pass any CUPS option (repeatable). Use options to discover available settings (tray, quality, media type, duplex, color mode).
  • Symlinks are followed but the resolved path must be inside the workspace or /tmp

Printer Info

python3 {baseDir}/scripts/print.py info
python3 {baseDir}/scripts/print.py info --printer "Custom_Printer"
python3 {baseDir}/scripts/print.py info --json

Shows manufacturer, model, resolution, color support, default paper, duplex mode, input trays, and all paper sizes with margins.

Printer Options

python3 {baseDir}/scripts/print.py options
python3 {baseDir}/scripts/print.py options --printer "Custom_Printer"
python3 {baseDir}/scripts/print.py options --json

Shows all CUPS options with current values and available choices.

Notes

  • Uses the system default printer unless --printer is specified
  • All commands support --json for machine-readable output
  • Image conversion respects the printer's imageable area (margins) from the PPD
  • Only printable file types accepted: PDF, PNG, JPG, GIF, BMP, TIFF, WebP

Tips

Tray / Media Selection

Some PPDs have empty InputSlot command strings, so -o InputSlot=tray-2 alone may not work. Use the combined media keyword instead:

# Print to a specific tray with media type
python3 {baseDir}/scripts/print.py print envelope.pdf -o media=A6,tray-2,envelope

# Format: -o media=SIZE,TRAY,TYPE
# SIZE: A4, A5, A6, EnvDL, EnvC5, Letter, etc.
# TRAY: tray-1, tray-2, auto
# TYPE: stationery, envelope, cardstock, labels, etc.

This passes tray selection via IPP directly, bypassing the PPD.

安全使用建议
This skill appears to do what it says: it reads local CUPS PPDs, converts images with Pillow, and calls lp/lpstat/lpoptions. Before installing: 1) Confirm you run it on a machine with CUPS and trust the system printers (jobs go to local/network printers). 2) Be careful with the OPENCLAW_WORKSPACE env var — if set to a sensitive directory it will allow printing files from there; prefer leaving it unset or pointing to a dedicated workspace. 3) The script creates temporary PDF files (delete=False) — you may want to review or clean /tmp after use. 4) Review the included script if you need to be extra cautious; there are no network calls or secret exfiltration patterns visible. Overall the skill is coherent and proportional to its stated purpose.
功能分析
Type: OpenClaw Skill Name: cups-printer Version: 1.2.2 The skill bundle is benign. The `scripts/print.py` file implements robust input validation and path sanitization, specifically `_validate_file_path` to prevent path traversal and `_validate_printer_name` to prevent shell injection when interacting with CUPS commands (`lp`, `lpstat`, `lpoptions`). The `SKILL.md` documentation clearly outlines the skill's purpose and usage without any evidence of prompt injection attempts or instructions for malicious behavior. There are no signs of data exfiltration, persistence mechanisms, or unauthorized network activity.
能力评估
Purpose & Capability
Name/description ask for CUPS printing. Required binaries (python3, lp, lpstat, lpoptions) and dependency (Pillow) are exactly what a CUPS-aware printing tool needs. The pyproject dependency and script are proportional to the task.
Instruction Scope
SKILL.md tells the agent to run the included script which lists printers, queries PPDs, converts images to PDFs and invokes lp to submit jobs. The script's filesystem and command usage are limited to paths and tools relevant to printing (PPD files, workspace/tmp, and lp).
Install Mechanism
No install spec — instruction-only with a bundled script. No downloads or archive extraction. This minimizes install-time risk.
Credentials
No credentials requested. The script honors an optional OPENCLAW_WORKSPACE env var to allow printing only from workspace paths; this is reasonable but means the agent will trust that environment variable when allowing files. No other env vars are accessed.
Persistence & Privilege
always is false and the skill does not request system-wide changes or other skills' credentials. The script writes temporary PDF files when converting images (uses tempfile with delete=False), which is normal for this functionality.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cups-printer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cups-printer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.2
Smart duplex: auto-detect document orientation (portrait→long-edge, landscape→short-edge) for correct book-style binding. Fixes upside-down backs on portrait duplex prints.
v1.2.1
Replace uv run with python3 in all SKILL.md examples
v1.2.0
Structured resolution in JSON output (x_dpi/y_dpi), added tray/media selection tips to SKILL.md
v1.1.1
Add -o option passthrough for tray/quality/duplex. Rewrite README with practical examples.
v1.1.0
Smarter symlink handling: allow within workspace/tmp, block outside. Extension validated on resolved path.
v1.0.3
Best practices compliance: line buffering, status prefixes, YAML block style, full ignore files, README docs section
v1.0.2
Block symlink-based information disclosure (e.g. ln -s ~/.ssh/id_rsa secrets.pdf)
v1.0.1
Security hardening: file path validation, printer name validation, path traversal prevention
v1.0.0
Initial release: PPD-aware CUPS printing with JSON output
元数据
Slug cups-printer
版本 1.2.2
许可证
累计安装 3
当前安装数 3
历史版本数 9
常见问题

Printer 是什么?

Print images and PDFs to any CUPS printer. PPD-aware: reads paper sizes, margins, resolution, and duplex at runtime. Use when the user wants to print files (... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 783 次。

如何安装 Printer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cups-printer」即可一键安装,无需额外配置。

Printer 是免费的吗?

是的,Printer 完全免费(开源免费),可自由下载、安装和使用。

Printer 支持哪些平台?

Printer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Printer?

由 Oliver Drobnik(@odrobnik)开发并维护,当前版本 v1.2.2。

💬 留言讨论