安装djvulibre-3.5.24
下载地址:http://djvu.sourceforge.net/
下载压缩包解压好
# ./configure
# make && make install && make clean
安装poppler-0.18.3.tar.gz
下载地址:http://poppler.freedesktop.org/
# ./configure --enable-xpdf-headers --disable-poppler-qt4 --disable-cms --disable-poppler-cpp
# make && make install && make clean
安装poppler过程出错处理:
Package requirements (fontconfig >= 2.0.0) were not met:
解决办法:通过yum 安装 fontconfig-devel,再configure通过。
配置时必需添加 --enable-xpdf-headers 参数,否则安装pdf2djvu-0.7.12时会提示 fatal error: GfxState.h: No such file or directory
安装pdf2djvu-0.7.12
下载地址:http://code.google.com/p/pdf2djvu/
# ./configure --prefix=/usr/local/pdf2djvu-0.7.12 --without-graphicsmagick --without-xslt
# make && make install && make clean
可以指定使用的编译器
#./configure CFLAGS="-O3" CC="gcc462" CXXFLAGS="-O3" CXX="g++462" --prefix=/usr/local/pdf2djvu-0.7.12 --without-graphicsmagick --without-xslt
设置库的头文件查找路径,以下方式紧当前shell有用
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
错误处理:
checking for DJVULIBRE... no
configure: error: Package requirements (ddjvuapi >= 3.5.17) were not met:
No package 'ddjvuapi' found
设置库的头文件查找路径
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
提示POPPLER版本过低
checking for POPPLER... no
configure: error: Package requirements (poppler-splash >= 0.7.3) were not met:
下载新版安装
提示找不到:GfxState.h
g++ -fopenmp -g -O2 -Wall -Werror=overloaded-virtual -pthread -I/usr/local/include -I/usr/local/include/poppler -c -o config.o config.cc
cc1plus: error: unrecognized command line option "-Werror=overloaded-virtual"
重新安装poppler-0.18.3.tar.gz 添加 --enable-xpdf-headers 参数
gcc编译器版本太低
安装最新版gcc方法参看“CentOS 5.5 手动安装 GCC4.6.2”
使用方法:
# ./pdf2djvu -o /data/sphinx_doc_zhcn_0.9.djvu /data/sphinx_doc_zhcn_0.9.pdf
# djvutxt /data/sphinx_doc_zhcn_0.9.djvu /data/sphinx_doc_zhcn_0.9.txt
djvutxt默认在/usr/bin目录下