What is PDFtk and how to install PDFtk in CentOS?

Last modified: July 30, 2020
You are here:
Estimated reading time: 2 min

Those who want to do everyday things with PDF documents, then PDFtk is the one for you. PDF Toolkit is a multi-platform tool. This is the front end to the iText library. iText is an open source library which is capable of splitting, merging, encrypting, decrypting, uncompressing, recompressing, and repairing PDFs. It can also be used to handle watermarks, metadata and to fill the forms in PDF with the text file.

1) PDFtk Free (Open source)

2) PDFtk Pro (Proprietary paid)

3) Original command-line tool PDFtk Server

 

PDFtk Free

PDFtk Free is a tool used for quickly merging and splitting PDF documents and pages. This is a friendly graphic tool which is free. Many of the functions are not available in the PDFtk free edition. Now also available in Windows XP, Vista, Windows 7 and Windows8.

 

PDFtk Pro (Proprietary paid)

If you are looking for a quick split, merge, rotate, watermark, stamp and secure PDF pages and documents then go for PDFtk Pro (Proprietary paid). This tool makes it easy to work with PDFs because of its graphical interface application.

 

Original command-line tool PDFtk Server

PDF Toolkit Server edition is the original command-line tool. This edition is commonly used in the server side processing of PDFs. Most customers of this edition are software publishers that give their products the ability to handle PDFs.

 

How to install PDFtk on Red Hat or CentOS

To install PDFtk Server on Red Hat Enterprise Linux (RHEL versions 5 or 6) or CentOS (versions 5 or 6) follow these basic steps:

1) Download a binary RPM, build from a source RPM.

2) Build from source code

 

How to install command-line PDFtk Server on Red Hat Enterprise Linux or CentOS Linux:

1) Install from Binary RPM

Download the rpm suited for you the OS.

Red Hat Enterprise Linux (RHEL) 6 RPMs:

64-bit (x86_64)

32-bit (i686)

Red Hat Enterprise Linux (RHEL) 5 RPMs:

64-bit (x86_64)

32-bit (i386)

CentOS Linux 6 RPMs:

64-bit (x86_64)

32-bit (i686)

CentOS Linux 5 RPMs:

64-bit (x86_64)

32-bit (i386)

Next, install libgcj, on which pdftk depends:

sudo yum install libgcj

Finally, install the pdftk RPM you downloaded:

sudo rpm -i pdftk-2.02-1.*.rpm

 

2) Build and Install from Source RPM

If you are a person interested in building your own PDFtk Server for yourself, then you can use PDFtk Server RPM.  First you need to build a binary RPM which you can then install as mentioned above.

Initially you need to set up your RPM build environment. You should be building the RPM as an ordinary user, but not as root.

Next, install the tools you’ll need to build PDFtk Server:

sudo yum install gcc gcc-java libgcj libgcj-devel gcc-c++

Next, download PDFtk Server source RPM:

pdftk-2.02-1.el6.src.rpm

Perform this next step using an ordinary user account:

rpmbuild –rebuild pdftk-2.02-1.el6.src.rpm

After the completion you will find a binary in the RPMS directory created as part of the first step. Change into this RPMS directory and install the new RPM with:

sudo rpm -i pdftk-2.02-1.*.rpm

 

3) Build from Source Code

You can build and install PDFtk Server without using rpm as follows:

sudo yum install gcc gcc-java libgcj libgcj-devel gcc-c++

wget https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip

unzip pdftk-2.02-src.zip

cd pdftk-2.02-dist/pdftk

make -f Makefile.Redhat

sudo make -f Makefile.Redhat install

Upon completion, you will find pdftk in /usr/local/bin.

If you get a build error that says: gcj: Internal error: Killed (program jc1), it is possible that you don’t have enough computer memory.  This error has been seen on virtual machines with just 1GB of RAM.

While yum installing the dependencies you might also get an error:

yum update

Loaded plugins: fastestmirror

Setting up Update Process

Loading mirror speeds from cached hostfile

Illegal instruction

You could temporarily fix this problem, by setting the environment variable:

export NSS_DISABLE_HW_AES=1

 

If you need any further assistance please reach our support department.

Was this article helpful?
Dislike 0
Views: 140