PDFtk works on CentOS 7!

Installing PDFtk on CentOS/RHEL/Scientific Linux 7

In the transition to CentOS 7, the GNU compiler for the Java programming language libgcj was discontinued. This is partially due to it being dropped by the GCC suite. As it turns out, shared library linking of libgcj.so.10 from CentOS 6 is binary compatible with PDFtk. We use PDFtk in our office for collating documents that have been scanned, and it works great!

After searching online and finding lots of links with various levels of success and server admins having used PDFtk for over a decade, we decided to package it and provide it to the community.

Installation is simple, depending on your architecture:

x86_64

yum localinstall https://www.linuxglobal.com/static/blog/pdftk-2.02-1.el7.x86_64.rpm

i686

yum localinstall https://www.linuxglobal.com/static/blog/pdftk-2.02-1.el7.i686.rpm

After  Updating

If you are reading this article, then you probably just upgraded your system. Now would be a great time to consider security for your application and server infrastructure. There are many services that we offer including support, security, maintenance, monitoring, backups, and live SQL backup replication. We even offer a security hardened hosting environment!

Please let us know if you have any issues with these packages or if we may be of service!

Update: 2017-01-26

Some have asked for the .spec that we are using. Really are we are doing is repacking libgcj.so.10* which we pulled out of CentOS 6 libgcj-4.4.7-17.el6. PDFtk was downloaded as an RPM from their site unmodified except that we converted it to a tar and added libgcj. You may need to edit the spec to make it build on your system, but it works in our build environment: https://www.linuxglobal.com/static/blog/pdftk.spec

-Eric

24 thoughts on “PDFtk works on CentOS 7!

  1. I had pdftk working on centos 7 for awhile but somehow my yum update broke. I had used the previous method of:

    rpm -ivh –nodeps libgcj-4.4.7-16.el6.x86_64.rpm
    yum install pdftk-2.02-1.el6.x86_64.rpm

    and it was working. All of a sudden it’s now crashing, giving me these errors. I tried your install and the same thing is happening:

    ./test.sh
    Unhandled Java Exception in create_output():
    java.lang.ClassCastException: pdftk.com.lowagie.text.pdf.PdfNull cannot be cast to pdftk.com.lowagie.text.pdf.PdfDictionary
    at pdftk.com.lowagie.text.pdf.FdfReader.readFields(pdftk)
    at pdftk.com.lowagie.text.pdf.FdfReader.readPdf(pdftk)
    at pdftk.com.lowagie.text.pdf.PdfReader.(pdftk)
    at pdftk.com.lowagie.text.pdf.PdfReader.(pdftk)
    at pdftk.com.lowagie.text.pdf.FdfReader.(pdftk)

    Any idea what’s wrong? I can no longer get pdftk to work. I’m using it for fdf merging.

  2. Here’s another version of the error I get depending upon how I call pdftk whether I do so with an implicit path or not:

    #pdftk test.pdf fill_form test.fdf output testout.pdf

    Unhandled Java Exception in create_output():
    Unhandled Java Exception in main():
    java.lang.NullPointerException
    at gnu.gcj.runtime.NameFinder.lookup(libgcj.so.10)
    at java.lang.Throwable.getStackTrace(libgcj.so.10)
    at java.lang.Throwable.stackTraceString(libgcj.so.10)
    at java.lang.Throwable.printStackTrace(libgcj.so.10)
    at java.lang.Throwable.printStackTrace(libgcj.so.10)

    I have uninstalled libgcj and pdftk and re-installed multiple times.. I’ve been wrestling with this for days and cannot figure out how the system broke… any help is most appreciated

  3. Actually I found what my problem was – pdftk was working properly, although it will throw and error and crash if you try a fill_form command and there’s unbalanced parenthesis in any of the field values.

Leave a Comment