A command-line tool for working with PDFs
open sourceGPL-2.0-or-laterself-hostablefree
PDFtk Server is PDF Labs' long-standing command-line PDF toolkit by Sid Steward: merge, split, burst, rotate, encrypt and decrypt, fill AcroForms from FDF/XFDF, flatten forms, stamp and watermark, and read or update metadata and bookmarks. pdftk-java is a Java port of pdftk hosted on GitLab that keeps the pdftk command-line tool alive as a separate open-source project. Both are GPL; PDF Labs sells a $995 redistribution licence for shipping PDFtk Server inside non-GPL commercial products.
Problems it solves
- fill a fillable PDF form from a data file in a shell script
- flatten a filled-in PDF form so the values can't be edited any more
- burst a 200-page PDF into one file per page from the command line
- dump the names of all the form fields in a PDF so I can map my data to them
- glue a cover page onto every generated invoice in a bash loop
- stamp a 'COPY' watermark onto every page of a document on the server
- pull pages 3-7 out of one PDF and interleave them with another
- attach a spreadsheet inside a PDF or extract files embedded in one
- change the title, author and bookmarks of a PDF without opening it in an editor
- remove the password from a PDF I own so other tools can process it
- the old PHP library we use shells out to a PDF tool that no longer installs on the new Ubuntu
Features
- merge, split, burst and collate pages
- rotate pages
- encrypt output and decrypt password-protected input
- fill forms from FDF/XFDF, flatten forms, generate FDF stencils (dump_data_fields)
- background watermarks and foreground stamps
- report and update metadata and bookmarks
- attach files to pages or the document, unpack attachments
- uncompress and recompress page streams, attempt repair of corrupted PDFs
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what pdftk (PDFtk Server and pdftk-java) does.
- pdfcpu PDF tooling for Go and the command line
- Apache PDFBox The Apache PDFBox library is an open source Java tool for working with PDF documents.
- qpdf A content-preserving PDF document transformer
- Stirling-PDF Your PDFs. Your servers.
- pdf-lib Create and modify PDF documents in any JavaScript environment.
- PyMuPDF A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.