How to install the latest version of poppler?

To be able to open password-protected pdfs with Evince on my own system I found (after much testing) that I had to compile the latest release of Poppler from source and also compile the latest release of Evince, building it against the newer Poppler.

How to upgrade Poppler & Evince to fix problems opening password-protected PDF files

First install all these prerequisites for compiling:

sudo apt install g++ autoconf libfontconfig1-dev pkg-config libjpeg-dev libopenjpeg-dev gnome-common libglib2.0-dev gtk-doc-tools libyelp-dev yelp-tools gobject-introspection libsecret-1-dev libnautilus-extension-dev

(more dependencies may be found on other systems but I'm working from a 2-week old installation, so hopefully this will be enough for most)

Poppler

Open a terminal so you are in your home directory. If you are really keen on tidiness, you can make a new directory for the two source directories you are going to end up with, for example mkdir poppler and enter it: cd poppler.

First download the encoding files (no need to compile these) to the current working directory

wget https://poppler.freedesktop.org/poppler-data-0.4.7.tar.gz

Extract (it does untar cleanly):

tar -xf poppler-data-0.4.7.tar.gz

Enter the directory

cd poppler-data-0.4.7

And magically send the files to the right locations in /usr/share with:

sudo make install

Now go back up one level

cd ..

Download & extract the main package:

wget https://poppler.freedesktop.org/poppler-0.44.0.tar.xz
tar -xf poppler-0.44.0.tar.xz
cd poppler-0.44.0

Now run the configure file like this:

./configure --enable-poppler-glib

Here you will get errors if I missed anything from my list of dependencies above. The errors might be illuminating eg 'thing-you-need not found' in which case you can try sudo apt install thing-you-need and try again. If that doesn't work, try searching online for the error message.

If it exits without errors you can run:

make

Which will take a while. When it's done, you can use sudo make install but even better, you can use checkinstall to make this installation known to dpkg (yay!) so:

sudo apt install checkinstall
sudo checkinstall

If you ever want to uninstall this, you can conveniently do so with sudo dpkg -r poppler as checkinstall will politely inform you. If you use sudo make install you can still uninstall at any time by entering the source directory (so keep it!) and typing sudo make uninstall

Evince

We've already got the dependencies for Evince, so assuming you are still in the poppler directory go back up to home with cd or to wherever you want to download Evince.

wget http://ftp.gnome.org/pub/GNOME/sources/evince/3.20/evince-3.20.0.tar.xz
tar -xf evince-3.20.0.tar.xz
cd evince-3.20.0
./configure
make
sudo checkinstall

You've actually fallen in famous X-Y problem loop.

You don't need latest Evince to open password protected pdf. You can just install Foxit reader and make it default PDF viewer. It will gracefully open those pdf.

Download the Foxit reader from here https://www.foxitsoftware.com/downloads/ and install it by double clicking. If that doesn't seem to work, it might be missing executable permission. give it using chmod +x foxitreader.run like command

Anyway, here are some interesting readings on X-Y problem

  • https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
  • xyprobleminfo

sudo apt-get install python-poppler