DEV Community

Cover image for How to install pdf2htmlEX in Ubuntu 18.0.4
Andrew Eze
Andrew Eze

Posted on • Edited on

How to install pdf2htmlEX in Ubuntu 18.0.4

pdf2htmlEX is a tool that allows you to convert PDF to HTML without losing text or format. pdf2htmlEX renders PDF files in HTML, using modern Web technologies. It is very useful if you want to convert academic papers with lots of formulas and figures to HTML format

This post will show you how to install pdf2htmlEX to work with poppler-0.62.0 (as installed from the Ubuntu 18.04 LTS package).

As at the time of writing this post pdf2htmlEX is no longer packaged by Debian/Ubuntu, you will need to compile pdf2htmlEX yourself.

To get started you will need to install the dependencies

sudo apt-get update sudo apt-get install -y libpoppler-private-dev pkg-config cmake make gcc g++ libcairo-dev libspiro-dev libpng-dev libjpeg-dev libpoppler-dev libpango1.0- dev libfontforge-dev poppler-data openjdk-8-jre-headless libopenjp2-7-dev libopenjp2-7 libgdk-pixbuf2.0-dev libfontconfig1-dev poppler-utils 
Enter fullscreen mode Exit fullscreen mode

Download a copy of the repository

wget https://github.com/pdf2htmlEX/pdf2htmlEX/archive/v0.16.0-poppler-0.62.0-ubuntu-18.04.zip 
Enter fullscreen mode Exit fullscreen mode

Unzip and install

unzip v0.16.0-poppler-0.62.0-ubuntu-18.04.zip cd pdf2htmlEX-0.16.0-poppler-0.62.0-ubuntu-18.04 ./dobuild ./doinstall 
Enter fullscreen mode Exit fullscreen mode

If you encounter error about package not found like

pdf2htmlEX: error while loading shared libraries: libfontforge.so.4: cannot open shared object file: No such file or directory 
Enter fullscreen mode Exit fullscreen mode

Check if the package is installed, in this case libfontforge

$ dpkg -l | grep fontforge 
Enter fullscreen mode Exit fullscreen mode

You should see the following

 ii fontforge 1:20170731~dfsg-1 amd64 font editor ii fontforge-common 1:20170731~dfsg-1 all font editor (common files) ii libfontforge-dev 1:20170731~dfsg-1 amd64 font editor - runtime library (development files) ii libfontforge2 1:20170731~dfsg-1 amd64 font editor - runtime library 
Enter fullscreen mode Exit fullscreen mode

If you don't see the package, install it. However, if you have installed the packages and still got the error, type the following to set the path.

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH 
Enter fullscreen mode Exit fullscreen mode

Cheers!

Top comments (0)