https://linuxhint.com/install_pdftk_ubuntu/
PDF is an integral part of our everyday life. It’s a document format that’s trusted by every single platform. Often times, important documents and books are in PDF format. It’s so widespread that without an appropriate PDF tool at hand, no system is complete. Ubuntu offers a great flexibility in terms of software availability. It’s also one of the most popular Linux distros for being so simple yet powerful and fast, extremely suitable for new to moderate Linux users. Let’s grab PDFtk – the ultimate PDF toolkit you’ll ever need!
PDFtk
There are 2 versions of PDFtk available – Free, Pro ($3.99) and Server. The Pro version offers all the additional features like rotating the PDF, stamping etc. The Server version is the command-line utility for performing various tasks.
PDFtk is available in the default Ubuntu software repository. However, on the latest Ubuntu releases, it’s not accessible directly. You have to use a little trick to get in on your system.
Method 1
Run the following commands –
sudo apt update
Method 2
You can also download and build PDFtk by yourself. For doing so, you need the Java build tools and dependencies.
Run the following commands –
libcommons-lang3-java libbcprov-java
cd pdftk
mkdir libs
ln -st libs /usr/share/java/{commons-lang3,bcprov}.jar
java -jar build/jar/pdftk.jar --help
Method 3 (recommended)
Install the PDFtk snap –
Note that this is the “Server” version of PDFtk.
Using PDFtk
After the installation is complete, check out the app working perfectly –
In fact, running this command will show a short guide you can use. For the long, in-depth guide, run the following command –
For checking out the guide later, export it to a text file –
Here are some of the most used tasks you can do with PDFtk.
Encrypt a PDF (128-bit encryption)
Decrypt a PDF
Join multiple PDFs into one
You can also use wildcard –
Rotate PDF document (must be 1 page document)
pdftk dummy.pdf cat 1east 2-end output dummy_90.pdf
# 180° rotate
pdftk dummy.pdf cat 1-endsouth output dummy_180.pdf
Enjoy!