Run pdftk on Ubuntu 18.04 or later

The convenient pdf manipulation tool pdftk is not available in Ubuntu 18.04 repositories because of some licensing incompatibilities. Using some docker magic and a small script we’ll use it as in previous Ubuntu releases, since it’s still available in 16.04 repositories. Here we will exploit the docker capabilities to run the pdftk binaries in the container.

Prerequisites: docker should be installed and working. Easiest thing to do is

sudo apt-get update && sudo apt-get install docker-ce && sudo usermod -aG docker $USER

and reinitiate the user session for the changes to take effect (logoff completely and relogin) or you’ll be able to run docker as root user only.

A convenience installation one-liner (second version of the script):

sudo wget -O /usr/local/bin/pdftk && sudo chmod a+x /usr/local/bin/pdftk

Or for manual installation put this script somewhere on your $PATH named pdftk, ensure chmod a+x SCRIPT_PATH. Then use pdftk normally as you did before.

Comments, corrections are welcome )

Share and Enjoy !

0 0 0