Skip to content

Commit a726f77

Browse files
authored
Merge pull request #728 from jhauga/skill-pdftk-server
Add skill pdftk-server
2 parents 0ac73fd + d458dd6 commit a726f77

File tree

8 files changed

+811
-1
lines changed

8 files changed

+811
-1
lines changed

.codespellrc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
[codespell]
2+
23
# Ignore intentional misspellings used as examples and technical terms
4+
35
# numer - intentional example typo in add-educational-comments.prompt.md
6+
47
# wit - proper technical term/name (sardonic wit, Gilfoyle character trait)
8+
59
# aks - Azure Kubernetes Service (AKS) abbreviation
10+
611
# edn - Extensible Data Notation (Clojure data format)
12+
713
# ser - serialization abbreviation
14+
815
# ois - ObjectInputStream abbreviation in Java
16+
917
# gir - valid abbreviation/technical term
18+
1019
# rouge - Rouge is a syntax highlighter (not "rogue")
20+
1121
# categor - TypeScript template literal in website/src/scripts/pages/skills.ts:70 (categor${...length > 1 ? "ies" : "y"})
22+
1223
# aline - proper name (Aline Ávila, contributor)
24+
1325
# ative - part of "Declarative Agents" in TypeSpec M365 Copilot documentation (collections/typespec-m365-copilot.collection.md)
26+
1427
# dateA, dateB - variable names used in sorting comparison functions
28+
1529
# TE - HTTP transfer coding header
16-
ignore-words-list = numer,wit,aks,edn,ser,ois,gir,rouge,categor,aline,ative,afterall,deques,dateA,dateB,TE
30+
31+
# FillIn - pdftk-server skill reference file available permission
32+
33+
ignore-words-list = numer,wit,aks,edn,ser,ois,gir,rouge,categor,aline,ative,afterall,deques,dateA,dateB,TE,FillIn
34+
1735
# Skip certain files and directories
36+
1837
skip = .git,node_modules,package-lock.json,*.lock,website/build,website/.docusaurus

docs/README.skills.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Skills differ from other primitives by supporting bundled assets (scripts, code
5050
| [microsoft-skill-creator](../skills/microsoft-skill-creator/SKILL.md) | Create agent skills for Microsoft technologies using Learn MCP tools. Use when users want to create a skill that teaches agents about any Microsoft technology, library, framework, or service (Azure, .NET, M365, VS Code, Bicep, etc.). Investigates topics deeply, then generates a hybrid skill storing essential knowledge locally while enabling dynamic deeper investigation. | `references/skill-templates.md` |
5151
| [nano-banana-pro-openrouter](../skills/nano-banana-pro-openrouter/SKILL.md) | Generate or edit images via OpenRouter with the Gemini 3 Pro Image model. Use for prompt-only image generation, image edits, and multi-image compositing; supports 1K/2K/4K output. | `assets/SYSTEM_TEMPLATE`<br />`scripts/generate_image.py` |
5252
| [nuget-manager](../skills/nuget-manager/SKILL.md) | Manage NuGet packages in .NET projects/solutions. Use this skill when adding, removing, or updating NuGet package versions. It enforces using `dotnet` CLI for package management and provides strict procedures for direct file edits only when updating versions. | None |
53+
| [pdftk-server](../skills/pdftk-server/SKILL.md) | 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. | `references/download.md`<br />`references/pdftk-cli-examples.md`<br />`references/pdftk-man-page.md`<br />`references/pdftk-server-license.md`<br />`references/third-party-materials.md` |
5354
| [penpot-uiux-design](../skills/penpot-uiux-design/SKILL.md) | Comprehensive guide for creating professional UI/UX designs in Penpot using MCP tools. Use this skill when: (1) Creating new UI/UX designs for web, mobile, or desktop applications, (2) Building design systems with components and tokens, (3) Designing dashboards, forms, navigation, or landing pages, (4) Applying accessibility standards and best practices, (5) Following platform guidelines (iOS, Android, Material Design), (6) Reviewing or improving existing Penpot designs for usability. Triggers: "design a UI", "create interface", "build layout", "design dashboard", "create form", "design landing page", "make it accessible", "design system", "component library". | `references/accessibility.md`<br />`references/component-patterns.md`<br />`references/platform-guidelines.md`<br />`references/setup-troubleshooting.md` |
5455
| [plantuml-ascii](../skills/plantuml-ascii/SKILL.md) | Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or mentions plantuml ascii, text diagram, ascii art diagram. Supports: Converting PlantUML diagrams to ASCII art, Creating sequence diagrams, class diagrams, flowcharts in ASCII format, Generating Unicode-enhanced ASCII art with -utxt flag | None |
5556
| [powerbi-modeling](../skills/powerbi-modeling/SKILL.md) | Power BI semantic modeling assistant for building optimized data models. Use when working with Power BI semantic models, creating measures, designing star schemas, configuring relationships, implementing RLS, or optimizing model performance. Triggers on queries about DAX calculations, table relationships, dimension/fact table design, naming conventions, model documentation, cardinality, cross-filter direction, calculation groups, and data model best practices. Always connects to the active model first using power-bi-modeling MCP tools to understand the data structure before providing guidance. | `references/MEASURES-DAX.md`<br />`references/PERFORMANCE.md`<br />`references/RELATIONSHIPS.md`<br />`references/RLS.md`<br />`references/STAR-SCHEMA.md` |

skills/pdftk-server/SKILL.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
name: pdftk-server
3+
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.'
4+
---
5+
6+
# PDFtk Server
7+
8+
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.
9+
10+
## When to Use This Skill
11+
12+
- Merging or joining multiple PDF files into one
13+
- Splitting or bursting a PDF into individual pages
14+
- Rotating PDF pages
15+
- Encrypting or decrypting PDF files
16+
- Filling PDF form fields from FDF/XFDF data
17+
- Applying background watermarks or foreground stamps
18+
- Extracting PDF metadata, bookmarks, or form field information
19+
- Repairing corrupted PDF files
20+
- Attaching or extracting files embedded in PDFs
21+
- Removing specific pages from a PDF
22+
- Collating separately scanned even/odd pages
23+
- Compressing or decompressing PDF page streams
24+
25+
## Prerequisites
26+
27+
- PDFtk Server must be installed on the system
28+
- **Windows**: `winget install --id PDFLabs.PDFtk.Server`
29+
- **macOS**: `brew install pdftk-java`
30+
- **Linux (Debian/Ubuntu)**: `sudo apt-get install pdftk`
31+
- **Linux (Red Hat/Fedora)**: `sudo dnf install pdftk`
32+
- Access to a terminal or command prompt
33+
- Verify installation by running `pdftk --version`
34+
35+
## Step-by-Step Workflows
36+
37+
### Merge Multiple PDFs
38+
39+
```bash
40+
pdftk file1.pdf file2.pdf cat output merged.pdf
41+
```
42+
43+
Using handles for more control:
44+
45+
```bash
46+
pdftk A=file1.pdf B=file2.pdf cat A B output merged.pdf
47+
```
48+
49+
### Split a PDF into Individual Pages
50+
51+
```bash
52+
pdftk input.pdf burst
53+
```
54+
55+
### Extract Specific Pages
56+
57+
Extract pages 1-5 and 10-15:
58+
59+
```bash
60+
pdftk input.pdf cat 1-5 10-15 output extracted.pdf
61+
```
62+
63+
### Remove Specific Pages
64+
65+
Remove page 13:
66+
67+
```bash
68+
pdftk input.pdf cat 1-12 14-end output output.pdf
69+
```
70+
71+
### Rotate Pages
72+
73+
Rotate all pages 90 degrees clockwise:
74+
75+
```bash
76+
pdftk input.pdf cat 1-endeast output rotated.pdf
77+
```
78+
79+
### Encrypt a PDF
80+
81+
Set an owner password and a user password with 128-bit encryption (default):
82+
83+
```bash
84+
pdftk input.pdf output secured.pdf owner_pw mypassword user_pw userpass
85+
```
86+
87+
### Decrypt a PDF
88+
89+
Remove encryption using the known password:
90+
91+
```bash
92+
pdftk secured.pdf input_pw mypassword output unsecured.pdf
93+
```
94+
95+
### Fill a PDF Form
96+
97+
Populate form fields from an FDF file and flatten to prevent further edits:
98+
99+
```bash
100+
pdftk form.pdf fill_form data.fdf output filled.pdf flatten
101+
```
102+
103+
### Apply a Background Watermark
104+
105+
Place a single-page PDF behind every page of the input (input should have transparency):
106+
107+
```bash
108+
pdftk input.pdf background watermark.pdf output watermarked.pdf
109+
```
110+
111+
### Stamp an Overlay
112+
113+
Place a single-page PDF on top of every page of the input:
114+
115+
```bash
116+
pdftk input.pdf stamp overlay.pdf output stamped.pdf
117+
```
118+
119+
### Extract Metadata
120+
121+
Export bookmarks, page metrics, and document information:
122+
123+
```bash
124+
pdftk input.pdf dump_data output metadata.txt
125+
```
126+
127+
### Repair a Corrupted PDF
128+
129+
Pass a broken PDF through pdftk to attempt automatic repair:
130+
131+
```bash
132+
pdftk broken.pdf output fixed.pdf
133+
```
134+
135+
### Collate Scanned Pages
136+
137+
Interleave separately scanned even and odd pages:
138+
139+
```bash
140+
pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf
141+
```
142+
143+
## Troubleshooting
144+
145+
| Issue | Solution |
146+
|-------|----------|
147+
| `pdftk` command not found | Verify installation; check that pdftk is in your system PATH |
148+
| Cannot decrypt PDF | Ensure you are providing the correct owner or user password via `input_pw` |
149+
| Output file is empty or corrupt | Check input file integrity; try running `pdftk input.pdf output repaired.pdf` first |
150+
| Form fields not visible after fill | Use the `flatten` flag to merge fields into the page content |
151+
| Watermark not appearing | Ensure the input PDF has transparent regions; use `stamp` for opaque overlays |
152+
| Permission denied errors | Check file permissions on input and output paths |
153+
154+
## References
155+
156+
Bundled reference documents in the `references/` folder:
157+
158+
- [pdftk-man-page.md](references/pdftk-man-page.md) - Complete manual reference with all operations, options, and syntax
159+
- [pdftk-cli-examples.md](references/pdftk-cli-examples.md) - Practical command-line examples for common tasks
160+
- [download.md](references/download.md) - Installation and download instructions for all platforms
161+
- [pdftk-server-license.md](references/pdftk-server-license.md) - PDFtk Server licensing information
162+
- [third-party-materials.md](references/third-party-materials.md) - Third-party library licenses
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Download
2+
3+
PDFtk provides an installer for Windows. Many Linux distributions provide a PDFtk package you can download and install using their package manager.
4+
5+
## Microsoft Windows
6+
7+
Download the PDFtk Server installer for Windows 10 and 11 using the following command:
8+
9+
```bash
10+
winget install --id PDFLabs.PDFtk.Server
11+
```
12+
13+
Then run the installer:
14+
15+
```bash
16+
.\pdftk_server-2.02-win-setup.exe
17+
```
18+
19+
After installation, open a command prompt, type `pdftk` and press Enter. PDFtk will respond by displaying brief usage information.
20+
21+
## Linux
22+
23+
On Debian/Ubuntu-based distributions:
24+
25+
```bash
26+
sudo apt-get install pdftk
27+
```
28+
29+
On Red Hat/Fedora-based distributions:
30+
31+
```bash
32+
sudo dnf install pdftk
33+
```
34+
35+
## PDFtk Server GPL License
36+
37+
PDFtk Server (pdftk) is not public domain software. It can be installed and used at no charge under its [GNU General Public License (GPL) Version 2](https://www.pdflabs.com/docs/pdftk-license/gnu_general_public_license_2.txt). PDFtk uses third-party libraries. The [licenses and source code for these libraries are described here](https://www.pdflabs.com/docs/pdftk-license/) under Third-Party Materials.
38+
39+
## PDFtk Server Redistribution License
40+
41+
If you plan to distribute PDFtk Server as part of your own software, you will need a PDFtk Server Redistribution License. The exception to this rule is if your software is licensed to the public under the GPL or another compatible license.
42+
43+
The commercial redistribution license allows you, subject to the terms of the license, to distribute an unlimited number of PDFtk Server binaries as part of one distinct commercial product. Please read the full license:
44+
45+
[PDFtk Server Redistribution License (PDF)](https://pdflabs.onfastspring.com/pdftk-server)
46+
47+
Now available for $995:
48+
49+
[PDFtk Server Redistribution License](https://www.pdflabs.com/docs/pdftk-license/)
50+
51+
## Build PDFtk Server from Source
52+
53+
PDFtk Server can be compiled from its source code. PDFtk Server is known to compile and run on [Debian](https://packages.debian.org/search?keywords=pdftk), [Ubuntu Linux](https://packages.ubuntu.com/search?keywords=pdftk), [FreeBSD](https://www.freshports.org/print/pdftk/), Slackware Linux, SuSE, Solaris and [HP-UX](http://hpux.connect.org.uk/hppd/hpux/Text/pdftk-1.45/).
54+
55+
Download and unpack the source:
56+
57+
```bash
58+
curl -LO https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip
59+
unzip pdftk-2.02-src.zip
60+
```
61+
62+
Review the [pdftk license information](https://www.pdflabs.com/docs/pdftk-license/) in: `license_gpl_pdftk/readme.txt`.
63+
64+
Review the Makefile provided for your platform and confirm that `TOOLPATH` and `VERSUFF` suit your installation of gcc/gcj/libgcj. If you run `apropos gcc` and it returns something like `gcc-4.5`, then set `VERSUFF` to `-4.5`. The `TOOLPATH` probably does not need to be set.
65+
66+
Change into the `pdftk` sub-directory and run:
67+
68+
```bash
69+
cd pdftk
70+
make -f Makefile.Debian
71+
```
72+
73+
Substitute your platform's Makefile filename as needed.
74+
75+
PDFtk has been built using gcc/gcj/libgcj versions 3.4.5, 4.4.1, 4.5.0, and 4.6.3. PDFtk 1.4x fails to build on gcc 3.3.5 due to missing libgcj features. If you are using gcc 3.3 or older, try building [pdftk 1.12](https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-1.12.tar.gz) instead.

0 commit comments

Comments
 (0)