Installing PDFtk on CentOS/RHEL/Scientific Linux 7
Update: This procedure works in CentOS/RHEL/Rocky/Oracle Linux 8!
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:
yum localinstall https://www.linuxglobal.com/static/blog/pdftk-2.02-1.el7.x86_64.rpm
yum localinstall https://www.linuxglobal.com/static/blog/pdftk-2.02-1.el7.i686.rpm
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!
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
45 thoughts on “PDFtk works on CentOS 7 and 8!”
thanks for the help this worked perfectly installing PDFTK.
Super! merci 🙂
Hi guys, this package was fantastic but seems to be no longer available. Any chance you can publish again?
Thanks for bringing this to our attention!
The link should be fixed, so try now.
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!
Ótima ajuda, salvou meu dia.
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:
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
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():
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
Thanks so much! FWIW, it looks like this works for RHEL 6 and RHEL 8 as well. So, if you work on servers with various RHEL distros, you can just use this one command on all.
Quick shout out on this post. It helped me help a local non-profit. Just goes to show you that you never know how sharing knowledge will touch and affect others.
Hi Scott, I am glad that it was helpful! Let us know if we can be of service.
Thank you. I got this to work on a shared server on BlueHost. They upgraded me to CentOS7, which broke pdftk for me. When I called they said it wasn’t possible to install on CentOS7.
To make it work I renamed pdftk to pdftk.target. I then created a script I named pdftk to point to the pdftk.target which has the path to the libgcj.so.10 file.
I’m also using shared hosting on Bluehost but I have not been able to get pdftk installed. Any assistance you can provide would be greatly appreciated. Thanks
Thank you! Successful installed on CentOS 8!
You save me, thank you so much!
Thanks, that’s helpful!
Worked perfectly. Thank you
Funcionou perfeitamente. Obrigado.
pdftk on CentOS 8 ? Just rpm -ivh pdftk-2.02-1.el7.x86_64.rpm
After install, you will have pdftk also working in CentOS 8 (although the RPM is for CentOS 7…).
Thank you for saving my day upgrading from CentOS 7 to CentOS 8.
It is 2022 and it still helped me. The pdftk-java provided with my CentOS 7.9 took 2.5 minutes for a job instead of 34 seconds as it is the case with the gcj-Version.
T H A N K Y O U