I have seen the first answer to How to install poppler 0.73 on ubuntu 18.04 which basically consists of the following steps:
Compile and install Poppler 0.73 with checkinstall to the /usr/local:
sudo apt-get install libopenjp2-7-dev libgdk-pixbuf2.0-dev cmake checkinstall
sudo apt-get build-dep libpoppler-cpp-dev
cd ~/Downloads
wget https://poppler.freedesktop.org/poppler-0.73.0.tar.xz
tar -xf poppler-0.73.0.tar.xz
cd poppler-0.73.0
mkdir build
cd build
cmake ..
sudo checkinstall make install
Define the environment variable R_LD_LIBRARY_PATH to inform R about the Poppler libraries in /usr/local/lib:
echo "export R_LD_LIBRARY_PATH=\$R_LD_LIBRARY_PATH:/usr/local/lib" >> .bashrc
Compile the pdftools R-package inside R-shell:
install.packages("pdftools")
Test it from R-shell with any pdf-file
> pdftools::pdf_data(pdf="/usr/share/cups/data/default.pdf")
[1]]
[1] width height x y space text
<0 rows> (or 0-length row.names)
I wanted to know:
- would the answer also apply to Ubuntu 20.04 LTS? - I tried it, and it worked. However I realised later this is not be the best solution (see answers below).
- would it also apply to any more recent version of poppler? - didn't try, as I didn't want to mess up my working setup with version 0.73.
Here is the output of dpkg -l | grep -i poppler
after performing the above install (this is useful to determine how to uninstall, see below):
# dpkg -l | grep -i poppler
ii build 20200518-1 amd64 poppler-0.73.0
ii poppler-data 0.4.9-2 all encoding data for the poppler PDF rendering library
#
Use the following method to install Poppler in Ubuntu 20.04
Download Poppler
Install some dependencies(if missing)
Make install
At first you need to remove self-compiled deb-package of Poppler named build:
To install actual version of Poppler use package from repository:
And at next time - start from repository, build packages only if they are not available in the repositories. More detailed explanation is here.