Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
set -e
# 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 +x build_pdf2htmlEX.sh
# [sudo] ./build_pdf2htmlEX.sh
HOME_PATH=$(cd ~/ && pwd)
LINUX_ARCH="$(lscpu | grep 'Architecture' | awk -F\: '{ print $2 }' | tr -d ' ')"
POPPLER_NAME="poppler-0.63.0"
POPPLER_SOURCE="https://ftp.osuosl.org/pub/blfs/conglomeration/poppler/$POPPLER_NAME.tar.xz"
FONTFORGE_SOURCE="https://github.com/fontforge/fontforge.git"
PDF2HTMLEX_SOURCE="https://github.com/Rockstar04/pdf2htmlEX.git"
if [ "$LINUX_ARCH" == "x86_64" ]; then
echo "Removing old PPAs ..."
sudo apt-get install ppa-purge
ppa-purge ppa:coolwanglu/pdf2htmlex
ppa-purge ppa:fontforge/fontforge
echo "Updating all Ubuntu software repository lists ..."
apt-get update -qq
apt-get purge -qq -y pdf2htmlex fontforge
apt-get autoremove -qq -y
echo "Installing basic dependencies ..."
apt-get install -qq -y ttfautohint build-essential libtool autoconf python-pip gcc libgetopt++-dev pkg-config git default-jre
wget https://cmake.org/files/v3.10/cmake-3.10.1-Linux-x86_64.sh
sudo sh cmake-3.10.1-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir
echo "Installing Poppler ..."
apt-get install -qq -y libnss3-dev libopenjpeg-dev libjpeg-turbo8-dev libfontconfig1-dev libfontforge-dev poppler-data poppler-utils poppler-dbg
if [ ! -f "$POPPLER_NAME.tar.xz" ]; then
echo "Downloading poppler via source ..."
wget "$POPPLER_SOURCE"
fi
tar -xvf "$POPPLER_NAME.tar.xz"
cd "$POPPLER_NAME/"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_XPDF_HEADERS=ON -DENABLE_LIBOPENJPEG=none
make
make install
echo "Installing fontforge libuninameslist ..."
cd "$HOME_PATH"
echo "cloning fontforge libuninameslist via source ..."
git clone https://github.com/fontforge/libuninameslist.git
cd libuninameslist
autoreconf -i
automake
./configure
make
make install
echo "Installing fontforge ..."
cd "$HOME_PATH"
apt-get install -qq -y packaging-dev python-dev libpango1.0-dev libglib2.0-dev libxml2-dev giflib-dbg libjpeg-dev libtiff-dev uthash-dev libspiro-dev
echo "cloning fontforge via source ..."
git clone --depth 1 --single-branch --branch 20170731 "$FONTFORGE_SOURCE"
cd fontforge/
git checkout tags/20170731
./bootstrap
./configure
make
make install
ldconfig
echo "Installing Pdf2htmlEx ..."
cd "$HOME_PATH"
git clone --depth 1 "$PDF2HTMLEX_SOURCE"
cd pdf2htmlEX/
cmake .
make
make install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
cd "$HOME_PATH" && rm -rf "$POPPLER_NAME.tar.xz"
cd "$HOME_PATH" && rm -rf "$POPPLER_NAME/"
cd "$HOME_PATH" && rm -rf "libuninameslist"
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 "Build Complete"
@brecke

This comment has been minimized.

Copy link

brecke commented Jan 24, 2019

hey there, which versions of ubuntu has this been tested with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.