pi-pdf-watermark

Pi skill: Add customizable text watermarks to PDF files — center or tiled, with adjustable angle, font size, opacity, and color.

Packages

Package details

skill

Install pi-pdf-watermark from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-pdf-watermark
Package
pi-pdf-watermark
Version
1.0.1
Published
Jun 10, 2026
Downloads
not available
Author
diwu507
License
MIT
Types
skill
Size
17.8 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "skills": [
    "skills"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-pdf-watermark

pi-package License: MIT

Pi Skill — Add customizable text watermarks to PDF files. Center or tiled, with adjustable angle, font size, opacity, and color.

✨ Features

  • Two watermark modes: Single centered stamp or full-page tiled repeat
  • Fully customizable: Text content, rotation angle, font size, opacity, color
  • Auto page-size detection: Handles A4, Letter, and any custom page dimensions
  • Cross-platform: Auto-detects Chinese fonts on macOS / Linux / Windows
  • Non-destructive: Outputs a new _水印版.pdf file, never overwrites the original

🚀 Install

# Via npm (recommended)
pi install npm:pi-pdf-watermark

# Or via GitHub
pi install git:github.com/ssdiwu/pi-pdf-watermark

📖 Usage

Once installed, just say:

"给这个 PDF 打水印"

The skill will ask you what text to use, then generate the watermarked PDF.

Examples

What you say What happens
"给 report.pdf 打水印" Asks for text → defaults to tiled mode
"给 report.pdf 打上「机密」水印" Runs immediately, tiled
"打一个居中的 30° 水印" Uses center mode, 30° angle

Command Line (standalone)

You can also run watermark.py directly without Pi:

# Install dependencies
pip3 install pypdf reportlab

# Basic usage (tiled by default)
python3 skills/pdf-watermark/references/watermark.py input.pdf "模力无限"

# Center mode
python3 skills/pdf-watermark/references/watermark.py input.pdf "CONFIDENTIAL" --mode center --angle 30 --opacity 0.2

# Custom font size & opacity
python3 skills/pdf-watermark/references/watermark.py input.pdf "DRAFT" --mode tile --font-size 36 --opacity 0.1

# Custom output path
python3 skills/pdf-watermark/references/watermark.py input.pdf "内部资料" -o output.pdf

CLI Options

Option Default Description
input (required) Input PDF file path
text (required) Watermark text
--mode tile center (single) or tile (full-page)
--angle 45 Rotation angle in degrees
--font-size 42 Font size
--opacity 0.15 Opacity (0–1)
--output, -o *_水印版.pdf Output file path

🔧 How It Works

User says "打水印"
       ↓
Skill asks: "请问要打什么水印文字?"
       ↓
User replies: "模力无限"
       ↓
Script runs with default tile mode → outputs *_水印版.pdf

Default behavior:

  • Mode: Tiled (满铺) — covers entire page at 45°
  • Only asks for watermark text, everything else uses sensible defaults
  • Switches to center mode only when user explicitly requests it

📦 Dependencies

  • pypdf — PDF reading/writing
  • reportlab — PDF generation (for watermark layer)

Both are installed automatically when running via Pi, or manually via:

pip3 install pypdf reportlab

🏗️ Package Structure

pi-pdf-watermark/
├── package.json              # Pi manifest + npm metadata
├── README.md                 # This file
├── LICENSE                   # MIT License
└── skills/
    └── pdf-watermark/
        ├── SKILL.md          # Skill definition (Pi reads this)
        └── references/
            └── watermark.py   # Watermark script (CLI-ready)

🤝 Contributing

PRs welcome! Feel free to open issues for feature requests or bugs.

📄 License

MIT © ssdiwu