Follow these directions to build pdftk on your favorite platform. They cover Windows, Mac OS X, Linux (Debian, SuSE, etc.), FreeBSD, and Solaris.
Visit the Packages and Installers page to see if somebody has already packaged pdftk for your platform.
I build pdftk using gcc/gcj/libgcj versions 3.3.4. I have tried to improve support for older versions of gcc, such as 3.2. Please let me know what luck you have compiling pdftk with older versions of gcc.
Different Linux distributions package libgcj differently; here are some examples (please e-mail me with updates and additions): Debian: libgcj4-dev, SuSE: libgcj-devel, Slackware: gcc-java (I believe).
Windows Build Notes
I build pdftk on my Windows system using MinGW and MSYS, versions: gcj 3.4.1, g++ 3.4.1.
Mac OS X Build Notes
Mac OS X users must build and install GCJ, first. John M. Gabriele has an article titled Using GCJ on OS X Panther that walks you through the procedure. He has confirmed that pdftk builds and runs on OS X. You will need to edit Makefile.MacOSX and change TOOLPATH to reflect the location of your GCJ toolset. Brian D. Foy shares your frustration at having to build GCJ. Please e-mail me with any links to GCJ installers for OS X.
Source RPM Download for SuSE and Other RPM-Based Linux Distributions
Bernhard Walle has kindly provided a source RPM for pdftk 1.12.
From his download page: "... the SRPMs work for every RPM-based distribution. That is RedHat/Fedora, Mandrake, SuSE and some others. Just use rpmbuild --rebuild ....src.rpm to get a RPM for your Linux installation."
Tobias adds these further notes:
The command rpmbuild may not be recognized on all rpm versions and Linux distributions out there. In this case please try:
rpm --rebuild packagename.src.rpm
Please also note that you need the following libraries:
libgcj
libgcj-devel
gcc-java
libwmf
libjasper
In case of a 'segmentation fault'- error when calling pdftk, check if you had these libraries available during install process.
Also check your version of gcc as mentioned under the Suse 8.2 notes:
gcc under Version 3.4 seems not to compile with the source rpms.
Thanks, Tobias!
SuSE 8.2 Build Notes
Stefan Armbruster notes: "The gcj version shipping with Suse 8.2 (it's gcc 3.3) seems to be buggy. After installing the recent gcc 3.4.1, pdftk compiles and runs fine. If you read the follow ups to http://gcc.gnu.org/ml/java/2003-04/msg00266.html, there is a reference to a gcj patch. This seems to be applied if 3.4.1."
Debian Woody (a/k/a Debian Stable) Build Notes
Andreas Reck notes: "I've finally managed to get pdftk working with the gcc + glibc from
readme.gzipped.org ...
Tried to compile it with a plain woody install on my laptop, but this didn't
work out I guess the gcj version 3.0.4-5 is too old.
I've tried it with an backport but this did not work either. So I think the
best advice for woody users who want to get pdftk working is to use the
readme.gzipped.org Packages, because they seemed to be really stable and
provide a good quality."
Review the Makefile provided for your platform and confim that TOOLPATH and VERSUFF suit your installation of gcc/gcj/libgcj. If you run apropos gcc and it returns something such as gcc-3.3, then set VERSUFF to -3.3. The TOOLPATH needs to be set only if you have compiled gcc/gcj yourself and installed it in a location that isn't in your PATH (you know who you are).
Change into the pdftk sub-directory,
Debian systems: run make -f Makefile.Debian
RedHat systems: run make -f Makefile.RedHat
Mandrake systems: run make -f Makefile.Mandrake
Mac OS X systems: run make -f Makefile.MacOSX
Solaris systems: run make -f Makefile.Solaris
Windows systems: run make -f Makefile.Windows
All Others: run make -f Makefile.Generic
Reduce the resulting filesize with strip, e.g.: strip pdftk.exe