npx skills add ...
npx skills add github/awesome-copilot --skill pdftk-server
npx skills add github/awesome-copilot --skill 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.
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.
winget install --id PDFLabs.PDFtk.Serverbrew install pdftk-javasudo apt-get install pdftksudo dnf install pdftkpdftk --versionUsing handles for more control:
Extract pages 1-5 and 10-15:
Remove page 13:
Rotate all pages 90 degrees clockwise:
Set an owner password and a user password with 128-bit encryption (default):
Remove encryption using the known password:
Populate form fields from an FDF file and flatten to prevent further edits:
Place a single-page PDF behind every page of the input (input should have transparency):
Place a single-page PDF on top of every page of the input:
Export bookmarks, page metrics, and document information:
Pass a broken PDF through pdftk to attempt automatic repair:
Interleave separately scanned even and odd pages:
| 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 |
Bundled reference documents in the references/ folder:
pdftk input.pdf cat 1-12 14-end output output.pdfpdftk input.pdf cat 1-endeast output rotated.pdfpdftk input.pdf output secured.pdf owner_pw mypassword user_pw userpasspdftk secured.pdf input_pw mypassword output unsecured.pdfpdftk form.pdf fill_form data.fdf output filled.pdf flattenpdftk input.pdf background watermark.pdf output watermarked.pdfpdftk input.pdf stamp overlay.pdf output stamped.pdfpdftk input.pdf dump_data output metadata.txtpdftk broken.pdf output fixed.pdfpdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf