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
thanks for the help this worked perfectly installing PDFTK.
– Jay
Super! merci 🙂
Hi guys, this package was fantastic but seems to be no longer available. Any chance you can publish again?
– Ronan
Hey Ronan,
Thanks for bringing this to our attention!
The link should be fixed, so try now.
-Daniel
Perfect! Thanks!
saved my day !
Thanks a lot!!!
Thanks it works very well!
saved time, good one.
You saved my life.
thank you! it works
Thanks a lot, saved my day !
I’m another who agrees with nicholas. Thanks very much for this.
This is exactly what I needed. Thanks for your hard work!
Have not tested all features, but I can confirm this works for concatenation in CentOS 7.4 1708 3.10.0-693.5.2.el7.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
Thank you very much!
Thank you!!!
Parabéns
Ótima ajuda, salvou meu dia.
merci
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.
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
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.
Thanks so much for offering this!
Worked for me 🙂
Thank You very much !!!
Worked like a charm. Thank you all so ver much!! Cheers
Thank you so much! In May-June I had scoured the Internet for a solution for Fedora 28. Wasn’t aware you people had looked into it in August. Very glad you did.
Thank you so much, saved the day!
Eric, you are a superhero! Long live PDFtk on Centos 7!
thanks, you saved my day!
Thanks, this also saved us a lot of troubles!
Thank you very much !
Still very useful even in 2019. I hope you will do a version for Centos 8.0 as well as soon as it is released. If there was a Donate button I definitely would.
Thank you so much sir!
Thanks a lot… it works
Works on RHEL 8 too! Thanks so much