pdftk-server

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.

23 stars

Best use case

pdftk-server is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using pdftk-server should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/pdftk-server/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/backend-dev/pdftk-server/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/pdftk-server/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How pdftk-server Compares

Feature / Agentpdftk-serverStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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`
- Access to a terminal or command prompt
- Verify installation by running `pdftk --version`

## Step-by-Step Workflows

### Merge Multiple PDFs

```bash
pdftk file1.pdf file2.pdf cat output merged.pdf
```

Using handles for more control:

```bash
pdftk A=file1.pdf B=file2.pdf cat A B output merged.pdf
```

### Split a PDF into Individual Pages

```bash
pdftk input.pdf burst
```

### Extract Specific Pages

Extract pages 1-5 and 10-15:

```bash
pdftk input.pdf cat 1-5 10-15 output extracted.pdf
```

### Remove Specific Pages

Remove page 13:

```bash
pdftk input.pdf cat 1-12 14-end output output.pdf
```

### Rotate Pages

Rotate all pages 90 degrees clockwise:

```bash
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):

```bash
pdftk input.pdf output secured.pdf owner_pw mypassword user_pw userpass
```

### Decrypt a PDF

Remove encryption using the known password:

```bash
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:

```bash
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):

```bash
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:

```bash
pdftk input.pdf stamp overlay.pdf output stamped.pdf
```

### Extract Metadata

Export bookmarks, page metrics, and document information:

```bash
pdftk input.pdf dump_data output metadata.txt
```

### Repair a Corrupted PDF

Pass a broken PDF through pdftk to attempt automatic repair:

```bash
pdftk broken.pdf output fixed.pdf
```

### Collate Scanned Pages

Interleave separately scanned even and odd pages:

```bash
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](references/pdftk-man-page.md) - Complete manual reference with all operations, options, and syntax
- [pdftk-cli-examples.md](references/pdftk-cli-examples.md) - Practical command-line examples for common tasks
- [download.md](references/download.md) - Installation and download instructions for all platforms
- [pdftk-server-license.md](references/pdftk-server-license.md) - PDFtk Server licensing information
- [third-party-materials.md](references/third-party-materials.md) - Third-party library licenses

Related Skills

server-management

23
from christophacham/agent-skills-library

Server management principles and decision-making. Process management, monitoring strategy, and scaling decisions. Teaches thinking, not commands.

rust-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete Rust Model Context Protocol server project with tools, prompts, resources, and tests using the official rmcp SDK

ruby-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete Model Context Protocol server project in Ruby using the official MCP Ruby SDK gem.

python-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete MCP server project in Python with tools, resources, and proper configuration

php-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete PHP Model Context Protocol server project with tools, resources, prompts, and tests using the official PHP SDK

mcp-copilot-studio-server-generator

23
from christophacham/agent-skills-library

Generate a complete MCP server implementation optimized for Copilot Studio integration with proper schema constraints and streamable HTTP support

kotlin-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete Kotlin MCP server project with proper structure, dependencies, and implementation using the official io.modelcontextprotocol:kotlin-sdk library.

java-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete Model Context Protocol server project in Java using the official MCP Java SDK with reactive streams and optional Spring Boot integration.

go-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete Go MCP server project with proper structure, dependencies, and implementation using the official github.com/modelcontextprotocol/go-sdk.

csharp-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete MCP server project in C# with tools, prompts, and proper configuration

btcpay-server-automation

23
from christophacham/agent-skills-library

Automate Btcpay Server tasks via Rube MCP (Composio). Always search tools first for current schemas.

azure-communication-callingserver-java

23
from christophacham/agent-skills-library

Azure Communication Services CallingServer (legacy) Java SDK. Note - This SDK is deprecated. Use azure-communication-callautomation instead for new projects. Only use this skill when maintaining le...