MyNixOS website logo
Description

A Toolkit for PDF Files.

Provides functions to manipulate PDF files: fill out PDF forms; merge multiple PDF files into one; remove selected pages from a file; rename multiple files in a directory; rotate entire pdf document; rotate selected pages of a pdf file; Select pages from a file; splits single input PDF document into individual pages; splits single input PDF document into parts from given points.

This is a port of pfdtk into Java. The current goal is to make a translation as faithful as it is reasonable and to fix any issues present in the original (correctness takes precedence over compatibility, see the differences), leaving possible improvements and refactoring for later. So far all code has been manually translated and it passes the test suite of php-pdftk, but a lot more testing is needed. Due to the differences between C++ and Java, it is likely that a few bugs have sneaked in with respect to the original; any help in catching them will be appreciated.

Installation on Debian/Ubuntu

An official pdftk-java package is available for Debian >= 10 and Ubuntu >= 18.10. There is also a package in a third-party repository intended for earlier OS releases that can be installed as follows:

sudo add-apt-repository ppa:malteworld/ppa
sudo apt update
sudo apt install pdftk

Dependencies

  • jdk >= 1.7
  • commons-lang3
  • bcprov
  • gradle >= 4.0 or ant (build time)
  • ivy (optionally for ant, for resolving dependencies at build time)

Building and running with Gradle

If you have gradle installed you can produce a standalone jar with:

gradle shadowJar

Alternatively, a pre-built jar is also available.

This can then be run with just java installed like:

java -jar build/libs/pdftk-all.jar

The build configuration is relatively simple so it should work with most versions of gradle since 4.0 (tested 4.0, 4.10.3 and 5.0) but if you have problems try installing gradle wrapper at a particular version and then running the wrapper:

gradle wrapper --gradle-version 5.0
./gradlew shadowJar

Building and running with ant

With ivy:

$ ant

Without ivy: install bcprov and commons-lang3, make a directory lib and link bcprov.jar and commons-lang3.jar into it. Then:

$ ant jar

To run:

$ java -cp build/jar/pdftk.jar:lib/bcprov.jar:lib/commons-lang3.jar com.gitlab.pdftk_java.pdftk

Known differences with pdftk

The following differences with respect to the original version of pdftk are intended. Issue reports about other differences are welcome.

  • Does not ask for owner password if not needed.
  • Does not report some structure-only form fields.
  • Reports some missing values in multi-valued form fields.

Source organization

java/com/ contains the translated Java sources. Currently these are a few large files, but they should be split into one class per file.

java/pdftk/ contains the sources for an old, yet-to-be-determined version of the iText library. They were modified in the original C++ sources, hence it is not obvious whether they can be replaced by a more recent vanilla version.

Metadata

Version

3.2.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD 13
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd13
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows