← Back to Skills Marketplace
zss04124586

PDF Watermark

by zss04124586 · GitHub ↗ · v1.0.4
cross-platform ✓ Security Clean
380
Downloads
1
Stars
4
Active Installs
5
Versions
Install in OpenClaw
/install pdf-watermark
Description
PDF文字水印工具 / PDF text watermark tool. 智能检测页面方向,自动调整角度和大小,支持中文,居中显示。Auto-detects page orientation, adjusts angle & size, supports Chinese, centered.
README (SKILL.md)

PDF 水印添加工具

为 PDF 文档添加文字水印,支持智能适配和中文内容。

使用流程

1. 获取必要信息

必须确认的信息:

  • 📄 PDF 文件路径(本地路径或 URL)
  • 📝 水印文字内容 - 如果用户未提供,必须主动询问: "请告诉我水印文字内容(如'内部资料'、'机密'、姓名日期等):"

可选参数(用户未指定时使用默认值):

  • 透明度:默认 0.25(25%,不影响阅读)
  • 角度:默认自动计算(竖版约30°,横版约25°)
  • 字体大小:默认自动根据页面尺寸计算

2. 执行水印添加

使用脚本 scripts/add_pdf_watermark.py

# 全自动模式(推荐)
python3 scripts/add_pdf_watermark.py \x3C输入PDF路径> "\x3C水印文字>" [输出PDF路径]

# 自定义参数
python3 scripts/add_pdf_watermark.py \x3C输入PDF> "\x3C水印文字>" \x3C输出PDF> \x3C角度> \x3C透明度> \x3C字体大小>

参数说明:

  • \x3C输入PDF路径>: 源文件路径或 URL
  • "\x3C水印文字>": 要显示的水印文字(必须提供)
  • \x3C输出PDF路径>: 可选,默认为 原文件名_watermarked.pdf
  • \x3C角度>: 可选,默认 "auto" 自动计算
  • \x3C透明度>: 可选,0.0-1.0,默认 0.25
  • \x3C字体大小>: 可选,默认 "auto" 自动计算

3. 智能特性

脚本会自动:

  • 🔍 检测页面方向:竖版/横版/方版
  • 📐 智能计算角度:竖版约30°,横版约25°,方版约35°
  • 📏 自动调整字体:根据页面尺寸计算最佳字体大小(28-60px范围)
  • 🎯 页面居中:水印始终位于页面几何中心
  • 📝 中文支持:自动加载系统可用的中文字体(黑体/宋体/苹方等)

4. 处理远程文件

如果用户提供的是 URL,先下载文件:

curl -L "\x3CPDF_URL>" -o /tmp/temp_input.pdf
python3 scripts/add_pdf_watermark.py /tmp/temp_input.pdf "\x3C水印文字>" /tmp/output_watermarked.pdf

5. 发送结果

处理完成后,将带水印的 PDF 文件发送给用户。

示例

场景1:用户提供了所有信息

用户:给这个文件加水印 "内部资料-张三 2024/01/15",文件是 report.pdf
执行:python3 scripts/add_pdf_watermark.py report.pdf "内部资料-张三 2024/01/15" report_watermarked.pdf

场景2:用户未提供水印内容

用户:帮我给这个PDF加水印
回复:请告诉我水印文字内容(如"内部资料"、"机密"、姓名日期等):
用户回复后:再执行加水印操作

场景3:从URL下载

用户:给 http://example.com/doc.pdf 加水印 "机密文件"
执行:
  curl -L "http://example.com/doc.pdf" -o /tmp/doc.pdf
  python3 scripts/add_pdf_watermark.py /tmp/doc.pdf "机密文件" /tmp/doc_watermarked.pdf

注意事项

  • 水印使用灰色半透明,确保不影响原文阅读
  • 中文自动检测系统字体,优先使用黑体(STHeiti)
  • 每页独立计算,混合方向页面也能正确处理
  • 输出文件默认保存在工作目录
Usage Guidance
This skill appears to be what it says: a local PDF watermarking script. Before installing/using it: (1) ensure Python packages pypdf and reportlab are installed (they are required but not documented); (2) only process PDFs you trust or have permission to modify — SKILL.md suggests using curl to download remote PDFs, so downloading untrusted files can be risky; (3) the script looks for system fonts in common locations to support Chinese text, which is normal; (4) run the script in a safe/test environment first to verify behavior and output naming; (5) no credentials are requested and the skill does not exfiltrate data based on the provided code, but always review and run code locally if you need to be certain.
Capability Analysis
Type: OpenClaw Skill Name: pdf-watermark Version: 1.0.4 The skill is a legitimate utility for adding text watermarks to PDF documents. The Python script (scripts/add_pdf_watermark.py) uses standard libraries like pypdf and reportlab to process files and includes logic for font registration and smart positioning. There is no evidence of data exfiltration, malicious execution, or prompt injection; the use of curl in SKILL.md is strictly for downloading user-provided PDF URLs for processing.
Capability Assessment
Purpose & Capability
The name/description match the included script and instructions. The skill asks only for an input PDF (path or URL) and watermark text and does not request unrelated credentials, binaries, or config paths.
Instruction Scope
SKILL.md stays within the stated purpose: it explains required inputs, optional parameters, how to run the included script, and how to download a remote PDF via curl before processing. It does not instruct reading unrelated files or exfiltrating data. One small omission: the README does not list required Python packages (pypdf, reportlab) that the script uses.
Install Mechanism
This is instruction-only (no install spec). The included script depends on Python packages (pypdf, reportlab) but the skill does not provide an install step or document those dependencies — operational gap rather than malicious behavior.
Credentials
No environment variables, credentials, or config paths are requested. The script probes standard system font paths locally to find a Chinese font, which is appropriate for the stated feature (Chinese support).
Persistence & Privilege
always is false and the skill does not attempt to modify other skills or system-wide agent settings. It runs ad-hoc and writes only the output PDF that the user specifies.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install pdf-watermark
  3. After installation, invoke the skill by name or use /pdf-watermark
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.4
Natural bilingual description without explicit CN/EN markers
v1.0.3
Shortened description for better display - concise Chinese and English
v1.0.2
Fixed description formatting with proper Chinese/English sections and complete translations
v1.0.1
Added English description for bilingual support
v1.0.0
Initial release: Auto-detect page orientation (portrait/landscape), smart watermark positioning, Chinese text support
Metadata
Slug pdf-watermark
Version 1.0.4
License
All-time Installs 4
Active Installs 4
Total Versions 5
Frequently Asked Questions

What is PDF Watermark?

PDF文字水印工具 / PDF text watermark tool. 智能检测页面方向,自动调整角度和大小,支持中文,居中显示。Auto-detects page orientation, adjusts angle & size, supports Chinese, centered. It is an AI Agent Skill for Claude Code / OpenClaw, with 380 downloads so far.

How do I install PDF Watermark?

Run "/install pdf-watermark" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is PDF Watermark free?

Yes, PDF Watermark is completely free (open-source). You can download, install and use it at no cost.

Which platforms does PDF Watermark support?

PDF Watermark is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created PDF Watermark?

It is built and maintained by zss04124586 (@zss04124586); the current version is v1.0.4.

💬 Comments