Centos 7--pdf2htmlEX安装和配置

  • 安装依赖
sudo yum install  cmake gcc gnu-getopt java-1.8.0-openjdk libpng-devel fontforge-devel cairo-devel poppler-devel libspiro-devel freetype-devel  poppler-data libjpeg-turbo-devel git make gcc-c++ 
  • 下载软件包,最终下载完成后
8.6M    pdf2htmlEX-0.14.6.tar.gz
21M     fontforge-pdf2htmlEX.zip
git clone https://github.com/coolwanglu/pdf2htmlEX.git
https://github.com/coolwanglu/fontforge/tree/pdf2htmlEX
  • 解压并安装

tar zxvf pdf2htmlEX-0.14.6.tar.gz
  • 设置环境变量
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
source /etc/profile
  • 编译安装

[yx@web-n1 pdf2htmlEX-0.14.6]$ cmake .
Trying to locate cairo-svg...
-- checking for module 'libfontforge>=2.0.0'
-- found libfontforge, version 2.0.20140101
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yx/mayc/pdf2htmlEX-0.14.6

注意,在cmake这一不的时候会提示你fontforge版本太低,找不到,所以我们先来解决一下这个问题:

1.首先去下载作者指定的fotforge-devel版本:
https://github.com/coolwanglu/fontforge/tree/pdf2htmlEX
2.根据INSTALL-git.md中的说明安装
先是使用命令./autogen.sh
然后使用命令./configure
使用make命令
使用make install命令
  • fontforge版本的问题解决后重新执行【编译安装cmake . && make  && sudo make install】这一步。

[yx@web-n1 pdf2htmlEX-0.14.6]$ make 
Scanning dependencies of target pdf2htmlEX
[  2%] Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o
[  5%] Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoRescaleBox.cc.o
[  8%] Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoOutputDev.cc.o
[ 11%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/pdf2htmlEX.cc.o
[ 13%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/draw.cc.o
[ 16%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/general.cc.o
[ 19%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/image.cc.o
[ 22%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/font.cc.o
[ 25%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/form.cc.o
[ 27%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/link.cc.o
[ 30%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/outline.cc.o
[ 33%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/state.cc.o
[ 36%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLRenderer/text.cc.o
[ 38%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/BackgroundRenderer/BackgroundRenderer.cc.o
[ 41%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/BackgroundRenderer/SplashBackgroundRenderer.cc.o
[ 44%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/BackgroundRenderer/CairoBackgroundRenderer.cc.o
[ 47%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/const.cc.o
[ 50%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/encoding.cc.o
[ 52%] Building C object CMakeFiles/pdf2htmlEX.dir/src/util/ffw.c.o
[ 55%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/math.cc.o
[ 58%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/misc.cc.o
[ 61%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/path.cc.o
[ 63%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/unicode.cc.o
[ 66%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/util/mingw.cc.o
[ 69%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/ArgParser.cc.o
[ 72%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/Base64Stream.cc.o
[ 75%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/Color.cc.o
[ 77%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/CoveredTextDetector.cc.o
[ 80%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/DrawingTracer.cc.o
[ 83%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLTextLine.cc.o
[ 86%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/HTMLTextPage.cc.o
[ 88%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/Preprocessor.cc.o
[ 91%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/StringFormatter.cc.o
[ 94%] Building CXX object CMakeFiles/pdf2htmlEX.dir/src/TmpFiles.cc.o
Linking CXX executable pdf2htmlEX
[ 94%] Built target pdf2htmlEX
Scanning dependencies of target pdf2htmlEX_resources
[ 97%] Generating share/base.min.css, share/fancy.min.css
++ dirname share/build_css.sh
+ BASEDIR=share
+ YUI_DIR=share/../3rdparty/yuicompressor
+ YUI_JAR=share/../3rdparty/yuicompressor/yuicompressor-2.4.8.jar
+ build base.css base.min.css
+ INPUT=share/base.css
+ OUTPUT=share/base.min.css
+ echo 'Building share/base.min.css with YUI Compressor'
Building share/base.min.css with YUI Compressor
+ java -jar share/../3rdparty/yuicompressor/yuicompressor-2.4.8.jar --charset utf-8 -o share/base.min.css share/base.css
+ echo Done.
Done.
+ build fancy.css fancy.min.css
+ INPUT=share/fancy.css
+ OUTPUT=share/fancy.min.css
+ echo 'Building share/fancy.min.css with YUI Compressor'
Building share/fancy.min.css with YUI Compressor
+ java -jar share/../3rdparty/yuicompressor/yuicompressor-2.4.8.jar --charset utf-8 -o share/fancy.min.css share/fancy.css
+ echo Done.
Done.
[100%] Generating share/pdf2htmlEX.min.js
++ dirname share/build_js.sh
+ BASEDIR=share
+ CLOSURE_COMPILER_DIR=share/../3rdparty/closure-compiler
+ CLOSURE_COMPILER_JAR=share/../3rdparty/closure-compiler/compiler.jar
+ INPUT=share/pdf2htmlEX.js
+ OUTPUT_FN=pdf2htmlEX.min.js
+ OUTPUT=share/pdf2htmlEX.min.js
+ echo 'Building pdf2htmlEX.min.js with closure-compiler...'
Building pdf2htmlEX.min.js with closure-compiler...
+ java -jar share/../3rdparty/closure-compiler/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --output_wrapper '(function(){%output%})();' --js share/pdf2htmlEX.js --js_output_file share/pdf2htmlEX.min.js
+ echo Done.
Done.
[100%] Built target pdf2htmlEX_resources
  • 安装
[yx@web-n1 pdf2htmlEX-0.14.6]$ sudo make install 
[ 94%] Built target pdf2htmlEX
[100%] Built target pdf2htmlEX_resources
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/bin/pdf2htmlEX
-- Removed runtime path from "/usr/local/bin/pdf2htmlEX"
-- Installing: /usr/local/share/pdf2htmlEX/compatibility.js
-- Installing: /usr/local/share/pdf2htmlEX/compatibility.min.js
-- Installing: /usr/local/share/pdf2htmlEX/base.css
-- Installing: /usr/local/share/pdf2htmlEX/base.min.css
-- Installing: /usr/local/share/pdf2htmlEX/fancy.css
-- Installing: /usr/local/share/pdf2htmlEX/fancy.min.css
-- Installing: /usr/local/share/pdf2htmlEX/LICENSE
-- Installing: /usr/local/share/pdf2htmlEX/manifest
-- Installing: /usr/local/share/pdf2htmlEX/pdf2htmlEX.js
-- Installing: /usr/local/share/pdf2htmlEX/pdf2htmlEX.min.js
-- Installing: /usr/local/share/pdf2htmlEX/pdf2htmlEX-64x64.png
-- Installing: /usr/local/share/man/man1/pdf2htmlEX.1
  • 安装完成。验证,当前目录下会多一个test.html文件。成功。
[yx@web-n1 mayc]$ pdf2htmlEX test.pdf 
Preprocessing: 130/130
Working: 130/130

 

你可能感兴趣的:(运维,系统)