coolwanglu/pdf2htmlEX

How to compile pdf2htmlEX in CentOS 7?

Closed this issue · 7 comments

Which version of pdf2htmlEX and version of poppler and fontforge can be used?
I try to compile pdf2htmlEX in centos7, different versions have different errors, does anyone has any suggestions in compilation?

Managed to build it with following steps on CentOS 7 minimal ISO:

Setup:

sudo yum install epel-release
sudo yum install cmake gcc gnu-getopt libpng-devel libjpeg-turbo-devel
git make gcc-c++ libspiro-devel freetype cairo-devel java-1.8.0-openjdk openjpeg2-devel
m4 autoconf automake patch libtool libtool-ltdl-devel pango-devel libxml2-devel

Poppler (recent version):

wget https://poppler.freedesktop.org/poppler-0.59.0.tar.xz
tar -xf poppler-0.59.0.tar.xz
cd poppler<tab>
./configure --prefix=/usr "--enable-xpdf-headers"
make
sudo make install
cd ..

Fontforge (recent version):

wget https://github.com/fontforge/fontforge/archive/20170731.tar.gz
tar -xzvf 20170731.tar.gz
cd fontforge<tab>
./bootstrap
./configure --prefix=/usr
make
sudo make install
cd ..

CentOS stuff:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

sudo su
echo /usr/local/lib > /etc/ld.so.conf.d/local.conf && ldconfig
exit

Forked pdf2htmlEX:

git clone -b incoming --single-branch https://github.com/billeranton/pdf2htmlEX.git

cd pdf2htmlEX
cmake .
make
sudo make install

Thanks! I have installed it successfully yesterday, here are some problems I have met:
1.
Linking CXX executable pdf2htmlEX /usr/local/lib/libfontforge.so: undefined reference to PyTuple_SetItem'
/usr/local/lib/libfontforge.so: undefined reference to PyObject_SelfIter'

install python-dev as wiki says, if it doesn't work, you can try to modify link.txt:
vim CMakeFiles/pdf2htmlEX.dir/link.txt \# add -lpython2.7

Linking CXX executable pdf2htmlEX CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/font.cc.o: In function pdf2htmlEX::HTMLRenderer::dump_embedded_font(GfxFont*, pdf2htmlEX::FontInfo&)':
font.cc:(.text+0x99e): undefined reference to Object::fetch(XRef*, Object*, int)' font.cc:(.text+0x9d8): undefined reference to Dict::lookup(char const*, Object*, int)'
font.cc:(.text+0x9f8): undefined reference to Dict::lookup(char const*, Object*, int)'

this is because of wrong version of libpoppler.so, the best solution is to find all libpoppler.so files under /usr/local and remove them, re-install poppler.

wung commented

pdf2htmlEX --debug 1 with_form.pdf

Preprocessing: 210/210
Add new temporary file: /tmp/pdf2htmlEX-LtNi8j/__css
Add new temporary file: /tmp/pdf2htmlEX-LtNi8j/__outline
Add new temporary file: /tmp/pdf2htmlEX-LtNi8j/__pages
Install font 1: (5 0) ABCDEE+̎ͥ
Add new temporary file: /tmp/pdf2htmlEX-LtNi8j/f1.ttf
Embed font: /tmp/pdf2htmlEX-LtNi8j/f1.ttf 1
The PostScript font name "宋体" is invalid.
It should be printable ASCII,
must not contain (){}[]<>%/ or space
and must be shorter than 63 characters
Segmentation fault

I tried above step, but stuck in the error libfontforge>=2.0.0 not exist. Anyone have any idea how to overcome this error ?
@coolwanglu , If possible please make your code compatible for centos 7 too.

@cuihaikuo , Why you have closed this issue ? have you got the solution? if yes , please pass on the same ?

@arpitj938 the same problem!!! and 4 hours is gone...I can`t deal it

for Fontforge (recent version):

# ./configure --prefix=/usr
-bash: ./configure: No such file or directory