Skip to content

Instantly share code, notes, and snippets.

@rajeevkannav
Last active March 29, 2022 18:28
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save rajeevkannav/d07f822e209a22d07176 to your computer and use it in GitHub Desktop.
Save rajeevkannav/d07f822e209a22d07176 to your computer and use it in GitHub Desktop.
Install CMake, pkg-config,GNU Getopt,GCC,poppler,fontforge,pdf2htmlEX in Ubuntu 15.05
#!/bin/bash
# Ubuntu Developer Script For pdf2htmlEx
# Created by Rajeev Kannav Sharma
# http://rajeevkannav.github.io/
#
#
# Downloads and configures the following:
#
# CMake, pkg-config
# GNU Getopt
# GCC
# poppler
# fontforge
# pdf2htmlEX
############################### How to use ###############################
# [sudo] chmod 775 pdf2htmlEX.sh
# [sudo] ./pdf2htmlEX.sh
HOME_PATH=$(cd ~/ && pwd)
LINUX_ARCH="$(lscpu | grep 'Architecture' | awk -F\: '{ print $2 }' | tr -d ' ')"
POPPLER_SOURCE="http://poppler.freedesktop.org/poppler-0.33.0.tar.xz"
FONTFORGE_SOURCE="https://github.com/fontforge/fontforge.git"
PDF2HTMLEX_SOURCE="https://github.com/coolwanglu/pdf2htmlEX.git"
if [ "$LINUX_ARCH" == "x86_64" ]; then
echo "Updating all Ubuntu software repository lists ..."
apt-get update
echo "Installing basic dependencies ..."
apt-get install -qq -y cmake gcc libgetopt++-dev git
echo "Installing Poppler ..."
apt-get install -qq -y pkg-config libopenjpeg-dev libfontconfig1-dev libfontforge-dev poppler-data poppler-utils poppler-dbg
echo "Downloading poppler via source ..."
wget "$POPPLER_SOURCE"
tar -xvf poppler-0.33.0.tar.xz
cd poppler-0.33.0/
./configure --enable-xpdf-headers
make
make install
echo "Installing fontforge ..."
cd "$HOME_PATH"
apt-get install -qq -y packaging-dev pkg-config python-dev libpango1.0-dev libglib2.0-dev libxml2-dev giflib-dbg
apt-get install -qq -y libjpeg-dev libtiff-dev uthash-dev libspiro-dev
echo "cloning fontforge via source ..."
git clone --depth 1 "$FONTFORGE_SOURCE"
cd fontforge/
./bootstrap
./configure
make
sudo make install
echo "Installing Pdf2htmlEx ..."
cd "$HOME_PATH"
git clone --depth 1 "$PDF2HTMLEX_SOURCE"
cd pdf2htmlEX/
cmake .
make
sudo make install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
cd "$HOME_PATH" && rm -rf "poppler-0.33.0.tar.xz"
cd "$HOME_PATH" && rm -rf "poppler-0.33.0"
cd "$HOME_PATH" && rm -rf "fontforge"
cd "$HOME_PATH" && rm -rf "pdf2htmlEX"
else
echo "********************************************************************"
echo "This script currently doesn't supports $LINUX_ARCH Linux archtecture"
fi
echo "----------------------------------"
echo "Restart your Ubuntu session for installation to complete..."
@tcufer
Copy link

tcufer commented Feb 20, 2016

Thanks for the script. It does work on 14.04 as well.

I had a problem with a line

echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc

which added the text to the last line in .bashrc file, where already was some other export command. Therefore, PATH was broken. It would be better to use printf:

printf "\n export LD_LIBRARY_PATH=/usr/local/lib:$s" "$LD_LIBRARY_PATH" >> ~/.bashrc

Tomaz

@benyu
Copy link

benyu commented May 27, 2016

After install and complain : Image format not supported jpg ?

@julianfox
Copy link

On Ubuntu 16.04.1 x64 (Digital ocean droplet) I got Error: Cannot open the manifest file when I use Pdf2HtmlEX... any workaround ?

@AroojPerzada
Copy link

I used these commands to run my pdf2htmlEX and now its not even converting my pdfs to html format, it keeps on saying core dump (Segmentation fault) what went wrong? How can I revert back to my homebrew changes i.e. https://github.com/fmalina/transcript .
PS: I'm using Ubuntu 16.04

@vinaymundada27
Copy link

I was able to run this script on Ubuntu 16.04 successfully without any errors (although there were a lot of warnings). After the installation I ran the following command :
pdf2htmlEX --zoom 1.3 test.pdf as given in the Quick Start Guide.

But I am getting the following error :
Preprocessing: 38/38 Segmentation fault (core dumped)
Is there anything that has to be done after running the script?

@strum3nt
Copy link

@krishna03312018
Copy link

thanks a lot Rajeev and Strum, this is very helpful

@mohammedyunus009
Copy link

Try this solution , script , solved my installation segementation my fault in ubuntu 16

Copy link

ghost commented May 10, 2019

tcufer commented Feb 20, 2016 ,Your point of view is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment