How to install poppler >= 0.73 on ubuntu 20.04 (any change since 18.04?)

6,854

Solution 1

At first you need to remove self-compiled deb-package of Poppler named build:

sudo apt-get purge build

To install actual version of Poppler use package from repository:

sudo apt-get update
sudo apt-get install libpoppler-dev

And at next time - start from repository, build packages only if they are not available in the repositories. More detailed explanation is here.

Solution 2

Use the following method to install Poppler in Ubuntu 20.04

Download Poppler

wget https://poppler.freedesktop.org/poppler-21.09.0.tar.xz
tar -xvf poppler-21.09.0.tar.xz

Install some dependencies(if missing)

sudo apt-get install libnss3 libnss3-dev
sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev

Make install

cd poppler-21.09.0/
mkdir build
cd build/
cmake  -DCMAKE_BUILD_TYPE=Release   \
       -DCMAKE_INSTALL_PREFIX=/usr  \
       -DTESTDATADIR=$PWD/testfiles \
       -DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
       ..
make 
sudo make install
Share:
6,854

Related videos on Youtube

jimbod119
Author by

jimbod119

Updated on September 18, 2022

Comments

  • jimbod119
    jimbod119 over 1 year

    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
    #
    
    • N0rbert
      N0rbert almost 4 years
      What is the question really? The 20.04 LTS already has fresh Poppler 0.86.
    • jimbod119
      jimbod119 almost 4 years
      sorry I never found that Poppler 0.86 on 20.04 LTS server. But then I'm not sure what I should have done to find and install it ?
    • N0rbert
      N0rbert almost 4 years
      Please add output of dpkg -l | grep -i poppler to the question body.
    • jimbod119
      jimbod119 almost 4 years
      output has been added
  • jimbod119
    jimbod119 almost 4 years
    Thanks a lot Norbert, that answers how to install it. I suppose I would have first to undo the installation of Poppler 0.73? (how?) And more fundamentally, if I may ask, how could I have checked and found out by myself that the package existed with that name in a repository (I'm not even sure which repository, nor whether it has to be added to my /etc/apt/sources.list file) and for that version of Ubuntu? (other than asking on Ask Ubuntu)?
  • N0rbert
    N0rbert almost 4 years
    See updated answer above. About packages the APT command-line utils and packages.ubuntu.com site provide information about the official repositories. More info: help.ubuntu.com/lts/ubuntu-help/addremove.html.en for desktop and ubuntu.com/server/docs/package-management for server.
  • jimbod119
    jimbod119 almost 4 years
    many thanks for the additional links, much appreciated!
  • Ido
    Ido about 2 years
    I also needed to do sudo apt install libopenjp2-7-dev -y (poppler-22.04.0)