Generated banner for Pdftk Server
Generated logo for Pdftk Server

Pdftk Server

GitHubOfficialFirst committed by jhaugaDistributed by GitHub

  • Skill
  • Tool integration
  • Automation and integrations
  • MIT
  • Low risk

From the author

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.
— the description by jhauga

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

PDFtk Server is a powerful command-line utility designed for programmatic PDF document manipulation. It provides a robust set of operations for handling PDF files, including merging, splitting, rotating, and encrypting documents. It also supports advanced features like filling PDF forms, applying watermarks or stamps, extracting metadata, and repairing corrupted files. This tool is ideal for users who need to automate document processing tasks directly from a terminal or within scripts.

What it does

  • Merges multiple PDF files into a single document
  • Splits or bursts PDF files into individual pages
  • Encrypts and decrypts PDF files with password protection
  • Fills PDF form fields using FDF or XFDF data
  • Applies background watermarks or foreground stamps to pages
  • Extracts metadata, bookmarks, and embedded file attachments

When to use it

  • When you need to automate PDF processing tasks via command-line scripts
  • When performing batch operations on large numbers of PDF files
  • When you need to secure sensitive documents with password encryption
  • When preparing documents by merging, rotating, or removing specific pages
  • When extracting data or attachments from existing PDF files

Advantages

  • Enables automation of repetitive PDF tasks
  • Supports complex operations like form flattening and page collation
  • Lightweight command-line interface suitable for server environments
  • Provides granular control over PDF structure and security

Usage examples

“How do I merge three PDF files into one using PDFtk?”
The agent provides the command: pdftk file1.pdf file2.pdf file3.pdf cat output merged.pdf.
“I need to password protect a PDF file, how can I do that?”
The agent provides the command: pdftk input.pdf output secured.pdf owner_pw mypassword user_pw userpass.
“How can I split a PDF into individual pages?”
The agent provides the command: pdftk input.pdf burst.
“How do I fill a PDF form and make it non-editable?”
The agent provides the command: pdftk form.pdf fill_form data.fdf output filled.pdf flatten.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/github/pdftk-server/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip pdftk-server.zip -d .agents/skills

Documentation by jhauga

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
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

IssueSolution
pdftk command not foundVerify installation; check that pdftk is in your system PATH
Cannot decrypt PDFEnsure you are providing the correct owner or user password via input_pw
Output file is empty or corruptCheck input file integrity; try running pdftk input.pdf output repaired.pdf first
Form fields not visible after fillUse the flatten flag to merge fields into the page content
Watermark not appearingEnsure the input PDF has transparent regions; use stamp for opaque overlays
Permission denied errorsCheck file permissions on input and output paths

References

Bundled reference documents in the references/ folder:

Files

references/pdftk-cli-examples.md

PDFtk CLI Examples

PDFtk is a command-line program. Use your computer terminal or command prompt when running these examples.

Collate Scanned Pages

Interleave even and odd scanned pages into a single document:

pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf

If the odd pages are in reverse order:

pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output collated.pdf

Decrypt a PDF

Remove encryption from a PDF using its password:

pdftk secured.pdf input_pw foopass output unsecured.pdf

Encrypt a PDF Using 128-Bit Strength

Apply owner password encryption:

pdftk 1.pdf output 1.128.pdf owner_pw foopass

Require a password to open the PDF as well:

pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz

Encrypt while still allowing printing:

pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing

Join PDFs

Merge multiple PDFs into one:

pdftk in1.pdf in2.pdf cat output out1.pdf

Using handles for explicit control:

pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf

Using wildcards to merge all PDFs in a directory:

pdftk *.pdf cat output combined.pdf

Remove Specific Pages

Exclude page 13 from a document:

pdftk in.pdf cat 1-12 14-end output out1.pdf

Using a handle:

pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

Apply 40-Bit Encryption

Merge and encrypt with 40-bit strength:

pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass

Join Files When One Is Password-Protected

Supply the password for the encrypted input:

pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf

Uncompress PDF Page Streams

Decompress internal streams for inspection or debugging:

pdftk doc.pdf output doc.unc.pdf uncompress

Repair Corrupted PDFs

Pass a broken PDF through pdftk to attempt repair:

pdftk broken.pdf output fixed.pdf

Burst a PDF into Individual Pages

Split each page into its own file:

pdftk in.pdf burst

Burst with encryption and limited printing:

pdftk in.pdf burst owner_pw foopass allow DegradedPrinting

Generate a PDF Metadata Report

Export bookmarks, metadata, and page metrics:

pdftk in.pdf dump_data output report.txt

Rotate Pages

Rotate the first page 90 degrees clockwise:

pdftk in.pdf cat 1east 2-end output out.pdf

Rotate all pages 180 degrees:

pdftk in.pdf cat 1-endsouth output out.pdf

Fill a PDF Form from Data

Populate form fields from an FDF file:

pdftk form.pdf fill_form data.fdf output filled_form.pdf

Flatten the form after filling (prevents further editing):

pdftk form.pdf fill_form data.fdf output filled_form.pdf flatten

Apply a Background Watermark

Stamp a watermark behind every page:

pdftk input.pdf background watermark.pdf output watermarked.pdf

Stamp an Overlay on Top

Apply an overlay PDF on top of every page:

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

Attach Files to a PDF

Embed files as attachments:

pdftk input.pdf attach_files table.html graph.png output output.pdf

Extract Attachments from a PDF

Unpack all embedded files:

pdftk input.pdf unpack_files output /path/to/output/

Requirements and compatibility

Written for: GitHub Copilot

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of jhaugajhauga
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · skills/pdftk-server · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
jhauga

AutoGineer is not affiliated with or endorsed by jhauga or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download pdftk-server.zip