Fact-checked by Grok 2 weeks ago

PDFtk

PDFtk (PDF Toolkit) is a cross-platform command-line utility for manipulating PDF documents, enabling tasks such as merging multiple PDFs into one, splitting a PDF into separate pages, rotating pages, filling forms, applying backgrounds or stamps, decrypting or encrypting files, and unpacking attachments, all while preserving the original content and structure. Developed by Sid Steward and first released on March 7, 2004, as version 0.93, PDFtk originated as a free, open-source tool written in Java to address common PDF editing needs through scripting and automation, particularly for server-side processing and client-side workflows. PDFtk quickly gained popularity among developers and users for its simplicity and reliability, with key milestones including the addition of form-filling capabilities in version 1.00 (August 14, 2004), support for AES encryption and bookmark merging in version 2.00 (May 22, 2013), and metadata handling enhancements in version 2.02 (July 24, 2013), which remains the current stable release. Operated under PDF Labs by Sid Steward, the author of the O'Reilly book PDF Hacks, PDFtk has evolved into a family of tools including the original PDFtk Server (free command-line version available for Linux, macOS, and Windows), PDFtk Free (a no-cost graphical interface for basic merging and splitting on Windows 10/11), and PDFtk Pro (a paid graphical application at $3.99 for advanced features like watermarking, securing, and batch processing on Windows 10/11). These versions maintain backward compatibility and are widely used in software publishing, web applications, and document automation, though the tool requires Java Runtime Environment (JRE) for operation on some platforms.

Introduction

Overview

PDFtk is a cross-platform command-line toolkit designed for straightforward manipulation of PDF documents, enabling common operations such as merging multiple files, splitting them into individual pages, rotating pages, and more. Developed by Sid Steward, it was first released in 2004 as an open-source solution under the GNU General Public License version 2, prioritizing ease of use for scripting and automation without requiring complex PDF expertise. From its origins as a basic command-line utility, PDFtk has evolved to encompass graphical user interfaces in variants like PDFtk Free and the PDFtk , expanding its accessibility for both and non-technical users. PDFtk Free and are graphical editions available only for and 11. This progression reflects its foundational philosophy of simplicity, allowing users to handle routine PDF tasks efficiently on desktop and server environments alike. The command-line PDFtk Server supports , Windows, and macOS platforms, facilitating broad adoption in diverse computing setups.

Platforms and Licensing

PDFtk supports multiple operating systems, enabling broad accessibility for users across different environments. The command-line PDFtk Server edition runs on Windows, macOS, and distributions. On Windows, it is distributed as native binaries via an installer executable, allowing straightforward setup without additional dependencies. For , installation typically occurs through package managers such as apt on Debian-based systems, or by compiling from for custom builds. On macOS, users can install binaries via a provided package installer or use Homebrew to manage the tool, often through the pdftk-java variant for compatibility. Licensing for PDFtk varies by edition to accommodate different user needs. PDFtk Server is released as under the GNU General Public License (GPL) version 2, which permits free use, modification, and distribution provided its terms are followed. However, redistribution of binaries within commercial products requires a separate commercial costing $995. PDFtk Free, a graphical built on the Server edition, operates as with no access provided, making it suitable for indefinite personal use without cost. PDFtk Pro, an enhanced version, requires a paid priced at $3.99 as of 2025 and includes an that governs its use, incorporating third-party libraries under their respective terms. All editions are primarily distributed through the official PDF Labs website, where users can download installers and documentation. The PDFtk Server edition is available via open-source repositories in some distributions, while others like and provide the pdftk-java port for compatibility, facilitating easy integration into workflows. For end-users, the free editions—Server and Free—support personal and non-commercial applications without licensing fees, while PDFtk targets scenarios with added support and features, ensuring compliance through its model. This tiered approach balances accessibility for hobbyists with professional-grade options for businesses.

History

Development Origins

PDFtk was developed by Sid Steward, a PDF expert and author of the 2004 book PDF Hacks, who founded PDF Labs to simplify PDF workflows. Motivated by the need for straightforward, command-line PDF manipulation tools that avoided the complexity and licensing costs of , Steward created PDFtk as an accessible alternative for users handling document merging, splitting, and form filling. This project emerged in 2004, a period of rapid PDF adoption for web distribution and professional printing, as the format had become a for cross-platform following its 1993 introduction by , yet open-source options for practical manipulation remained scarce. PDFtk addressed these gaps by offering a lightweight, scriptable utility that did not require like . Technically, PDFtk's initial foundation leveraged the open-source Java library—first released in 2000—for handling PDF structures and operations, while incorporating C++ code for efficient core processing such as page extraction and compression. The first version, 0.93, was released on March 7, 2004. Version 1.00, released on August 14, 2004, added key features such as form-filling capabilities, marking an important milestone in PDF processing. PDF Labs, operated by Steward since its inception, has served as the primary steward for PDFtk's maintenance, providing source code, documentation, and updates to ensure its reliability across platforms.

Key Releases and Milestones

PDFtk's development reached a significant milestone with the release of version 2.02 on July 24, 2013, which introduced options like drop_xmp for removing XMP and dump_data for extracting document information, alongside enhanced bookmark merging during PDF operations and fixes for issues including password handling and decryption errors. This version built on version 2.00's addition of decryption support, enabling compatibility with PDF 1.7 features such as 256-bit encryption (Extension Level 3), and improved overall error handling for greater stability. The tool has seen no official core updates from PDF Labs since 2013, reflecting its mature and reliable state for everyday PDF tasks. Following the stabilization of the command-line version, PDF Labs introduced graphical editions to broaden accessibility, launching PDFtk Free and PDFtk Pro in the mid-2010s as user-friendly interfaces built atop the core functionality. PDFtk Free offers basic merging and splitting without cost, while PDFtk Pro provides advanced features like watermarking and page rotation for a one-time fee, both emphasizing intuitive GUIs over command-line usage. A key community-driven milestone occurred on December 30, 2017, when Marc Vinyals initiated the pdftk-java project, a GPL-licensed port of the original tool designed to resolve compatibility challenges stemming from the of the GNU Compiler for Java (GCJ) in distributions like and issues with Oracle's JDK licensing. This port maintains functional parity with the original while leveraging standard Java runtime environments, facilitating continued adoption in open-source ecosystems. As of 2025, PDFtk's core remains unchanged, with ongoing maintenance occurring through third-party graphical frontends such as PDFTK Builder Enhanced version 4.1.9, released on November 15, 2025, which wraps the version 2.02 server tool in an enhanced GUI for Windows users.

Features

Core Manipulation Functions

PDFtk provides essential tools for manipulating the structure of PDF documents through command-line operations, enabling users to combine, divide, reorient, and restore files without requiring graphical interfaces or proprietary software. These functions operate on the document's page-level architecture, allowing precise control over content arrangement and integrity. Merging and are achieved primarily via the cat operation, which concatenates pages from one or more input PDFs into a single output file, supporting selective ranges and reordering for efficient document assembly. For instance, to combine the first three pages of file A with pages 1 through 2 of file B, the command pdftk A.pdf B.pdf cat A1-3 B1-2 output C.pdf produces a new PDF C with the specified sequence. This method handles multi-page inputs by assigning handles (e.g., A for the first file) and supports filters like even or odd pages, making it suitable for collating scanned documents or reports from disparate sources. Splitting and bursting functions facilitate the of individual pages or ranges from a PDF, breaking down large files into manageable components for archiving or further processing. The burst operation, for example, decomposes an input PDF into separate single-page files, naming them sequentially such as pg_0001.pdf, while also generating a doc_data.txt file summarizing the original structure including bookmarks and . Alternatively, users can extract specific ranges using cat with output redirection, though burst is optimized for full disassembly. Page rotation and manipulation allow targeted adjustments to page orientations within a document, correcting issues from scanning or layout errors without affecting content. Rotations are specified in degrees—north (0°), east (90° clockwise), south (180°), or west (270° clockwise)—applied to entire documents or page subsets via the rotate modifier. A command like pdftk input.pdf rotate 1-endeast output rotated.pdf applies a 90° clockwise rotation to all pages, while finer control such as pdftk A.pdf cat A1-5east A6-10west output adjusted.pdf rotates only designated ranges eastward or westward. Repair and operations address file integrity and editability by fixing structural damages and unpacking compressed for manual inspection or modification. To repair a corrupted PDF, PDFtk attempts to reconstruct damaged (XREF) tables and stream lengths, as in pdftk broken.pdf output fixed.pdf, which salvages readable content where possible without external dependencies. via uncompress expands page for , producing human-readable PostScript-like , followed by compress to restore the original ; for example, pdftk in.pdf uncompress output editable.pdf enables direct alterations before recompression. These features are particularly valuable for recovering partially damaged files from unreliable sources.

Forms and Overlay Operations

PDFtk supports form-related operations for generating and filling PDF forms, as well as applying overlays like backgrounds and stamps to documents. These features enable automation of form processing and visual enhancements without altering the underlying content structure. Form handling begins with generate_fdf, which extracts form field data from a filled PDF into an FDF (Forms Data Format) file for editing or reuse; for example, pdftk form.pdf generate_fdf output form.fdf creates an FDF file containing field values. To fill a form, the fill_form operation applies data from an FDF file to a blank PDF form: pdftk blank.pdf fill_form form.fdf output filled.pdf. Additional options like flatten integrate the form data permanently into the PDF, preventing further edits, as in pdftk blank.pdf fill_form form.fdf flatten output final.pdf. These capabilities are useful for batch form population in workflows. Overlay functions include applying backgrounds and stamps to pages. The background operation overlays a PDF page as a background on corresponding pages of an input document: pdftk front.pdf background back.pdf output under.pdf places the first page of back.pdf behind each page of front.pdf. For multiple backgrounds, multibackground attaches different background pages to specific input pages. Similarly, stamp places a PDF page on top of input pages: pdftk front.pdf stamp stamp.pdf output over.pdf, with multistamp for varied stamps per page. These operations support page ranges and are ideal for adding watermarks, headers, or footers across documents.

Metadata and Security Operations

PDFtk provides tools for viewing and modifying PDF , enabling users to extract and update document information such as titles, authors, subjects, and custom fields stored in the PDF Info dictionary. The dump_data operation reads a single input PDF and outputs its , bookmarks (outlines), page metrics (including media box dimensions, rotation, and labels), and other structural data to a or standard output. For instance, the command pdftk input.pdf dump_data output metadata.txt generates a report containing key-value pairs like "InfoKey: Title" and "InfoValue: Document Title", along with bookmark hierarchies and page labels. An optional variant, dump_data_utf8, ensures proper encoding for international characters in the output. To update , PDFtk uses the update_info , which applies changes from an input data file to the PDF's Info dictionary, supporting additions or modifications to standard fields (e.g., author, creator) and custom metadata in . Users prepare an file matching the dump_data , it—such as adding "InfoKey: CustomField" with "InfoValue: Example Value"—and then run pdftk input.pdf update_info info.txt output updated.pdf. This preserves existing bookmarks unless explicitly overridden and is useful for batch standardization of document properties. The counterpart, update_info_utf8, handles accented or non-ASCII characters reliably. For security, PDFtk supports encryption and decryption of PDFs using owner and user passwords to control access and permissions. Decryption requires the input password via input_pw <password>, allowing processing of secured files; for example, pdftk secured.pdf input_pw mypassword output unsecured.pdf removes protection if the password is correct. Encryption applies during output, setting an owner password for full control (e.g., pdftk input.pdf output secured.pdf owner_pw mypassword) or a user password for restricted access, with options to allow specific permissions like printing or content modification using allow <permissions> (e.g., allow Printing ModifyContents). The tool uses 128-bit RC4 encryption by default for output, with a 40-bit RC4 option via encrypt_40bit for compatibility with older viewers, though it can decrypt AES-encrypted inputs. PDFtk does not support 256-bit AES encryption in its original implementation. PDFtk also handles file attachments and stream for optimization and embedding. The attach_files operation embeds external files (e.g., images, documents) into a PDF, optionally associating them with a specific via to_page <n>; for example, pdftk input.pdf attach_files attachment.[txt](/page/TXT) to_page 1 output embedded.pdf adds the file to the first page's attachments. Conversely, unpack_files extracts all embedded files to a directory, as in pdftk input.pdf unpack_files output ./attachments/. For , the compress option restores or applies Flate compression to page streams during output (pdftk input.pdf compress output optimized.pdf), reducing , while uncompress removes it for easier text or (pdftk input.pdf uncompress output editable.pdf). These features aid in optimizing PDFs without altering core content. Despite these capabilities, PDFtk has limitations in advanced security features; it does not support applying or verifying digital signatures, which require certificate-based beyond password protection, nor does it implement (DRM) mechanisms like expiration dates or device binding. These omissions stem from its reliance on older PDF libraries, focusing instead on basic password-based and metadata handling.

Implementations

Original Command-Line Version

The original command-line version of PDFtk, known as PDFtk Server, is implemented primarily in C++ and interfaces with a GCJ-compiled version of the Java-based library for PDF manipulation tasks, integrating the native-compiled Java code into the C++ . This hybrid approach allows the tool to leverage iText's robust PDF handling while maintaining a native footprint. The source code is released under the (GPL) version 2 or later, making it freely available for modification and redistribution. Installation of PDFtk Server is straightforward across major platforms, with pre-built binaries provided for Windows via an executable installer that places the in the for command-line access. On distributions such as and , it can be installed directly from official repositories using package managers like apt. For macOS and other systems including , , and , users typically compile from source: download the source archive, adjust the Makefile for the target compiler (e.g., version), and run platform-specific build commands like make -f Makefile.[Debian](/page/Debian). However, due to the of GCJ in 2016, compiling on modern systems requires obtaining and using an older version with GCJ support, which may not be readily available. The command-line interface follows a modular syntax designed for flexibility in scripting environments: pdftk [<input PDF files | - | PROMPT>] [<operation> <operation arguments>] [output <output filename | - | PROMPT>] [options]. Input files can be specified directly (e.g., A=input1.pdf B=input2.pdf) or via stdin with -, and operations such as cat for merging or burst for splitting include arguments like page ranges (e.g., cat A1-5 B3-end). Output is directed to a file, stdout (-), or interactive prompt (PROMPT), with global options like user_pw for encryption or compress for optimization; the --help flag provides a concise summary of all available options and syntax. PDFtk Server excels in scriptable for batch PDF processing, such as merging multiple documents in scripts on servers or client machines, due to its integration with tools like or jobs. Its lightweight design, with binaries typically under 1 MB, ensures minimal resource overhead, making it ideal for embedding in automated workflows without the bloat of full graphical suites.

Java Port

The pdftk-java variant was developed by Marc Vinyals starting in 2017 as a pure port of the original PDFtk tool, primarily to address the deprecation of Compiler for Java (GCJ) runtime, which the original relied upon and caused widespread dependency and maintenance issues on modern distributions. This port was motivated by the need for a more portable and maintainable alternative amid evolving Java ecosystem challenges, including shifts in licensing and availability of . It is licensed under the License version 2.0 or later (GPL-2.0-or-later) and utilizes a modified version of the library based on 2.1.7, with partial updates to font handling from iText 4.2.0 for improved compatibility. In terms of compatibility, pdftk-java retains nearly all functionality of the original, aiming to serve as a drop-in replacement and passing the comprehensive php-pdftk test suite, though it achieves approximately 99% command parity with minor differences in behaviors such as owner password prompting and UTF-8 handling in output. It runs on any standard Java Virtual Machine (JVM) version 8 or higher, eliminating native dependencies and enabling seamless execution across platforms without compilation issues associated with GCJ. The port fully supports PDF 1.7 specifications, including form filling and manipulation operations, as verified through its bundled iText implementation. Key differences from the original include enhanced cross-platform portability due to its pure nature, avoiding GCJ-specific binaries, and ongoing active maintenance hosted on , with the latest release (v3.3.3 as of 2025) incorporating bug fixes and build improvements via tools like . This maintenance ensures reliability in environments where the original tool faces obsolescence. Adoption of pdftk-java has been prominent in open-source ecosystems and environments seeking to avoid or deprecated libraries, with official packaging in major distributions such as , , and , facilitating easy integration into server-side scripts and automation workflows. For instance, it is commonly incorporated into build tools like for PDF processing in Java-based projects, and it powers backend operations in tools like PDF Chain without requiring additional native setups.

Graphical Frontends and Variants

PDFtk offers several graphical user interfaces (GUIs) to provide more accessible alternatives to its command-line operations, enabling users to perform PDF manipulations through intuitive visual interfaces rather than terminal commands. These frontends build upon the core PDFtk Server tool, facilitating tasks such as merging, splitting, and editing PDFs without requiring scripting knowledge. The official PDFtk Free is a basic graphical tool designed for quick merging and splitting of PDF documents and pages, available at no cost for indefinite use. It targets Windows 10 and 11 users, offering a simple interface for everyday PDF assembly needs. In contrast, PDFtk Pro extends these capabilities with advanced features including rotation, watermarking, stamping, and security options like password protection, priced at $3.99 and also limited to Windows 10 and 11 as of 2025. These proprietary GUIs streamline workflows by integrating PDFtk's backend directly into a user-friendly environment, complete with setup installers and documentation. Community-developed frontends further expand PDFtk's accessibility, with PDFTK Builder Enhanced serving as a prominent open-source GUI for the Windows version of PDFtk Server. Released in version 4.1.9 on November 15, 2025, it enhances the original tool with batch processing, automatic page numbering, and additional operations like rotation and stamping, all while remaining free and licensed under open-source terms. Version 4.1.9 includes a bugfix for the 'Stamp' action to preserve PDF bookmarks when stamping the first page only. This frontend allows users to visually rearrange pages, add backgrounds, and handle multiple files efficiently through a drag-and-drop interface. Variants of these tools include portable editions, such as the PDFTK Builder Enhanced Portable packaged by , which enables USB-based deployment without installation, preserving full functionality for on-the-go PDF editing on Windows systems. Updated to version 4.1.9 on November 15, 2025, this format integrates seamlessly with the platform for easy management across devices. These graphical frontends and variants offer key advantages over the command-line version, including drag-and-drop workflows for file selection, real-time visual previews of page arrangements, and reduced learning curves for non-technical users, thereby broadening PDFtk's appeal in professional and educational settings.

References

  1. [1]
    PDFtk Server - PDF Labs
    PDFtk Server is our command-line tool for working with PDFs. It is commonly used for client-side scripting or server-side processing of PDFs.
  2. [2]
    PDFtk Server Manual - PDF Labs
    This pdftk manual documents all of its options and operations. Please consult our tutorials for some friendlier explanations. Pdftk is a command-line program, ...
  3. [3]
    PDFtk Version History - PDF Labs
    A history of PDFtk features and fixes. It also links to older versions of PDFtk. Added drop_xmp output option for removing the document XMP metadata stream ...
  4. [4]
    PDF Labs Company
    Our mission is to make PDF easier to use. PDF Labs is operated by Sid Steward, author of PDF Hacks (O'Reilly) and the popular PDF Toolkit.Missing: developer | Show results with:developer
  5. [5]
    PDFtk - The PDF Toolkit
    PDFtk is a simple tool for doing everyday things with PDF documents. It comes in three flavors: PDFtk Free, PDFtk Pro, and our original command-line tool ...PDFtk Server · PDFtk Pro · Guide to PDFtk Pro · Articles Tagged
  6. [6]
    PDFtk Pro - PDF Labs
    Use PDFtk Pro to quickly split, merge, rotate, watermark, stamp and secure PDF pages and documents. PDFtk Pro is a graphical application that makes working ...
  7. [7]
    PDFtk Server License - PDF Labs
    $$995.00PDFtk Server can be used for free under GPL. Commercial redistribution requires a license, unless the software is GPL or compatible.
  8. [8]
    pdftk-java - Homebrew Formulae
    pdftk-java. Install command: brew install pdftk-java. Port of pdftk in java. https://gitlab.com/pdftk-java/pdftk. License: GPL-2.0-or-later. Formula JSON API ...
  9. [9]
    PDF Labs Tools
    PDFtk Server is our command-line tool for working with PDFs. It is commonly used for client-side scripting or server-side processing of PDFs.
  10. [10]
    PDF Hacks [Book] - O'Reilly
    You'll learn how to manage content in PDF, navigate it, and reuse it as necessary. Far more than another guide to Adobe Acrobat, the book covers a variety of ...4. Creating PDF and Other... · 1. Consuming PDF · Preface
  11. [11]
    30 years of Adobe PDF for Commercial Print
    Mar 1, 2024 · PDF is the default for exchanging documents and print jobs, and its use continues to grow in every print segment.Missing: 2000s | Show results with:2000s
  12. [12]
    How PDF changed prepress production dramatically in the…
    Oct 24, 2018 · PDF became more and more popular for the digital exchange of prepress data. The first PDF output workflows systems were introduced by the traditional ...
  13. [13]
    Our history | iText PDF
    The first public release is iText 0.30 on 14 February 2000. 1999. Bruno Lowagie is working at the University of Ghent in Belgium (UGent) as a ...
  14. [14]
    [PDF] PDFTK Builder Enhanced - SourceForge
    May 6, 2025 · (Note: It is possible to remove or edit the individual objects added by PDFTK Builder with a PDF editor, such as Adobe Acrobat.) Page 15. PDFTK ...<|control11|><|separator|>
  15. [15]
    pdftk-java / pdftk-java · GitLab
    ### Summary of pdftk-java Initial Release/First Commit Date
  16. [16]
    HelpFile-PDFTK Builder
    PDFTK Builder is a free, graphical user interface (GUI) for the Windows version of the popular PDF ToolKit (PDFtk) command line tool, PDFtk Server by Sid ...
  17. [17]
    PDFtk Server Examples - PDF Labs
    These examples show you how to perform common PDF tasks from the command-line using pdftk. Looking for a friendly Windows GUI? Try our PDFtk Free!
  18. [18]
    pdftk is a sort-of-C++ program that contains code like - Hacker News
    Jul 10, 2017 · pdftk is a sort-of-C++ program that contains code like: #include "pdftk/com/lowagie/text/pdf/PdfReader. h" ... if( input_pdf_p->m_password. empty ...Missing: library | Show results with:library
  19. [19]
    Open Source PDF Tools in C/C++ - Google Groups
    There's libharu for creating PDFs. Also, Sid Steward (PDF Hacks) demonstrates how to compile the iText java PDF library and use it from C/C++ with his pdftk.
  20. [20]
    [Licensing vs Pdftk Server] (#106) · Issue - GitLab
    Aug 17, 2021 · Hello I'am concerned about license for pdftk-java as command line tool for server-side PDF processing in larger SASS application.
  21. [21]
    How to Install PDFtk on Linux - Baeldung
    Jul 6, 2024 · In this article, we discuss how to install PDFtk on Linux. We'll begin with installing PDFtk from the official package repositories.
  22. [22]
    pdftk-java - GCJ-free toolkit for manipulating PDF documents
    Oct 29, 2021 · PDFtk is a simple tool for doing everyday things with PDF documents: Merge PDF documents, split PDF pages into a new document, decrypt input as necessary.
  23. [23]
    How can I install pdftk in Ubuntu 18.04 and later?
    Apr 26, 2018 · The pdftk package in Ubuntu (and its upstream Debian package) was dropped due to its dependency on the now deprecated GCJ runtime.
  24. [24]
    pdftk-java - Fedora Packages
    Pdftk-java is a port of the original GCJ-based PDFtk to Java. The GNU Compiler for Java (GCJ) is a portable, optimizing, ahead-of-time compiler for the Java ...
  25. [25]
  26. [26]
    Debian -- Package Search Results -- pdftk-java
    Found 1 matching packages. Exact hits. Package pdftk-java. bullseye (oldoldstable) (text): pdftk port to java - a tool for manipulating PDF documents
  27. [27]
    PDFTK Builder Enhanced download | SourceForge.net
    A simple and practical free PDF editor software that allows users to edit PDFs like professionals and update your own PDF documents quickly and easily. Edit the ...
  28. [28]
    PDFTK Builder Enhanced Portable | PortableApps.com
    Mar 7, 2008 · PDFTK Builder is a pdf manipulation utility for Windows with a great array of features including: Collate - allows you to rearrange (reorder ...