PDFtk Server:Openclaw 技能的高级 PDF 操作
作者:互联网
2026-04-05
什么是 PDFtk Server 技能?
PDFtk Server 技能是一个直接从命令行管理 PDF 文档的综合工具包。此技能使开发人员和自动化代理能够执行复杂的文档操作,例如合并多个文件、将文档拆分为单独的页面以及添加水印。
作为 Openclaw 技能用户的重要组件,它填补了原始文档数据与专业 PDF 输出之间的空白。它在没有图形界面的服务器端 PDF 处理中特别有用,提供了一种编程方式来处理从简单的旋转到复杂的基于数据的表单填充的所有事务。
下载入口:https://github.com/openclaw/skills/tree/main/skills/jhauga/pdftk-server
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install pdftk-server
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 pdftk-server。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
PDFtk Server 技能 应用场景
- 将多个 PDF 报告自动合并为单个文档。
- 将大型 PDF 书籍或文档拆分为单独的页面文件。
- 使用 FDF/XFDF 数据编程填充 PDF 表单以实现自动化。
- 使用 128 位加密和密码保护来保护敏感文档。
- 修复损坏的 PDF 页面流以恢复无法访问的数据。
- 为生成的发票添加公司水印或背景印章。
- 用户或代理使用特定的操作标志(如 cat、burst 或 fill_form)调用 pdftk 命令。
- 引擎根据提供的句柄(例如 A=file1.pdf)读取并处理输入 PDF 文件。
- 对文档流应用页面旋转、加密或交错(shuffle)等转换。
- 根据 dump_data 命令的要求提取或修改元数据。
- 生成一个新的、经过修改的 PDF 文件作为输出,同时保留或扁平化文档结构。
PDFtk Server 技能 配置指南
在使用此 Openclaw 技能集成之前,请确保您的系统已安装 PDFtk Server:
- Windows:
winget install --id PDFLabs.PDFtk.Server - macOS:
brew install pdftk-java - Linux (Debian/Ubuntu):
sudo apt-get install pdftk - Linux (Red Hat/Fedora):
sudo dnf install pdftk
通过运行以下命令验证安装:
pdftk --version
PDFtk Server 技能 数据架构与分类体系
该技能与 PDF 文件和元数据导出进行交互。以下结构描述了使用的主要数据格式:
| 组件 | 数据类型 | 描述 |
|---|---|---|
| 输入 PDF | 二进制 | 要操作的源文档。 |
| FDF/XFDF | 文本/XML | 用于填充 PDF 表单字段的数据文件。 |
| 元数据 | 文本 | 通过 dump_data 提取的包含书签和页面指标的数据。 |
| 句柄 | 变量 | 用于管理多个输入流的引用(A、B 等)。 |
name: pdftk-server
description: 'Skill for using the command-line tool pdftk (PDFtk Server) for working with PDF files. Use when asked to merge PDFs, split PDFs, rotate pages, encrypt or decrypt PDFs, fill PDF forms, apply watermarks, stamp overlays, extract metadata, burst documents into pages, repair corrupted PDFs, attach or extract files, or perform any PDF manipulation from the command line.'
PDFtk Server
PDFtk Server is a command-line tool for working with PDF documents. It can merge, split, rotate, encrypt, decrypt, watermark, stamp, fill forms, extract metadata, and manipulate PDFs in a variety of ways.
When to Use This Skill
- Merging or joining multiple PDF files into one
- Splitting or bursting a PDF into individual pages
- Rotating PDF pages
- Encrypting or decrypting PDF files
- Filling PDF form fields from FDF/XFDF data
- Applying background watermarks or foreground stamps
- Extracting PDF metadata, bookmarks, or form field information
- Repairing corrupted PDF files
- Attaching or extracting files embedded in PDFs
- Removing specific pages from a PDF
- Collating separately scanned even/odd pages
- Compressing or decompressing PDF page streams
Prerequisites
- PDFtk Server must be installed on the system
- Windows:
winget install --id PDFLabs.PDFtk.Server - macOS:
brew install pdftk-java - Linux (Debian/Ubuntu):
sudo apt-get install pdftk - Linux (Red Hat/Fedora):
sudo dnf install pdftk
- Windows:
- Access to a terminal or command prompt
- Verify installation by running
pdftk --version
Step-by-Step Workflows
Merge Multiple PDFs
pdftk file1.pdf file2.pdf cat output merged.pdf
Using handles for more control:
pdftk A=file1.pdf B=file2.pdf cat A B output merged.pdf
Split a PDF into Individual Pages
pdftk input.pdf burst
Extract Specific Pages
Extract pages 1-5 and 10-15:
pdftk input.pdf cat 1-5 10-15 output extracted.pdf
Remove Specific Pages
Remove page 13:
pdftk input.pdf cat 1-12 14-end output output.pdf
Rotate Pages
Rotate all pages 90 degrees clockwise:
pdftk input.pdf cat 1-endeast output rotated.pdf
Encrypt a PDF
Set an owner password and a user password with 128-bit encryption (default):
pdftk input.pdf output secured.pdf owner_pw mypassword user_pw userpass
Decrypt a PDF
Remove encryption using the known password:
pdftk secured.pdf input_pw mypassword output unsecured.pdf
Fill a PDF Form
Populate form fields from an FDF file and flatten to prevent further edits:
pdftk form.pdf fill_form data.fdf output filled.pdf flatten
Apply a Background Watermark
Place a single-page PDF behind every page of the input (input should have transparency):
pdftk input.pdf background watermark.pdf output watermarked.pdf
Stamp an Overlay
Place a single-page PDF on top of every page of the input:
pdftk input.pdf stamp overlay.pdf output stamped.pdf
Extract Metadata
Export bookmarks, page metrics, and document information:
pdftk input.pdf dump_data output metadata.txt
Repair a Corrupted PDF
Pass a broken PDF through pdftk to attempt automatic repair:
pdftk broken.pdf output fixed.pdf
Collate Scanned Pages
Interleave separately scanned even and odd pages:
pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf
Troubleshooting
| Issue | Solution |
|---|---|
pdftk command not found |
Verify installation; check that pdftk is in your system PATH |
| Cannot decrypt PDF | Ensure you are providing the correct owner or user password via input_pw |
| Output file is empty or corrupt | Check input file integrity; try running pdftk input.pdf output repaired.pdf first |
| Form fields not visible after fill | Use the flatten flag to merge fields into the page content |
| Watermark not appearing | Ensure the input PDF has transparent regions; use stamp for opaque overlays |
| Permission denied errors | Check file permissions on input and output paths |
References
Bundled reference documents in the references/ folder:
- pdftk-man-page.md - Complete manual reference with all operations, options, and syntax
- pdftk-cli-examples.md - Practical command-line examples for common tasks
- download.md - Installation and download instructions for all platforms
- pdftk-server-license.md - PDFtk Server licensing information
- third-party-materials.md - Third-party library licenses
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
HealthClaw 牙科:AI 驱动的牙科诊所管理 - Openclaw Skills
ERPClaw 销售:AI 订单到现金全生命周期管理 - Openclaw Skills
ERPClaw 欧盟区域合规:增值税、OSS 和电子发票 - Openclaw Skills
ERPClaw 人事:AI 人力资源与美国薪酬管理 - Openclaw Skills
erpclaw-journals:安全且AI原生的簿记系统 - Openclaw Skills
ERPClaw Growth:AI CRM 与业务分析 - Openclaw Skills
ERPClaw Billing:基于用量与计量的计费 - Openclaw Skills
educlaw: AI 原生教育与 SIS 管理 - Openclaw Skills
EduClaw K-12 扩展组件:学生管理与合规 - Openclaw Skills
AuditClaw AWS:自动化 AWS 合规证据收集 - Openclaw Skills
AI精选
