1.下载
安装的依赖:
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++
pdf2html源码:https://github.com/coolwanglu/pdf2htmlEX.git
安装报错:package 'libfontforge>=2.0.0' not found、
需要安装:fontforge-pdf2htmlEX
2.安装fontforge
下载:https://github.com/coolwanglu/fontforge.git
2.1执行:./autogen.sh; 报错Preparing build ... ERROR: libtoolize failed
解决:没有安装libtool-ltdl-devel。
yum install libtool-ltdl-devel
2.2 执行 ./configure
configure: error: Package requirements (pango >= 1.10 pangoxft) were not met: No package 'pango' found No package 'pangoxft' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables PANGO_CFLAGS and PANGO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
这个问题困扰了好久,百度、google都没有找到,突然来了灵感;yum install pango-devel 解决
make && make install
3.接的安装pdf2html
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
[100%] Generating share/pdf2htmlEX.min.js make[2]: execvp: share/build_js.sh: Permission denied make[2]: *** [share/pdf2htmlEX.min.js] Error 127 make[1]: *** [CMakeFiles/pdf2htmlEX_resources.dir/all] Error 2 make: *** [all] Error 2 [root@iZije4ffdt70xyZ pdf2htmlEX-master]# 这个错误:原因是我直接复制到服务器的,文件缺少执行的权限。
最后:
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
python 执行:subprocess.call(r"pdf2htmlEX "+upload_pdf+" "+upload_html,shell=True)
参考资料:https://blog.csdn.net/paulluo0739/article/details/54286889