centos7安装pdf2htmlEX

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

1 概述

需要把PDF 转成 html,使用的是 pdf2htmlEX 工具。

2 安装

2.1 安装基本工具和依赖库

yum install vim unzip wget git gcc* cmake poppler* libtool* glib* gio* freetype* pango* cairo* -y

2.2 安装fontforge

2.2.1 下载

wget https://github.com/coolwanglu/fontforge/archive/pdf2htmlEX.zip

备注  如果提示 443... failed: Connection refused 多试几次就能下载 只要是不成功包括解压不成功等等都是文件下载不完整的问题多试几次直到文件成功下载下来 提示 saved 就是下载完整成功

2.2.2 解压安装

unzip pdf2htmlEX.zip
cd fontforge-pdf2htmlEX
./autogen.sh
./configure
make && make install

备注make的时候可能会出现如下的异常

ufo.c:925:12: error: conflicting types for 'SplinePointListInterpretGlif' SplineSet *SplinePointListInterpretGlif(char *filename,char *memory, int memlen, ^ In file included from fontforge.h:36:0, from fontforgevw.h:30, from ufo.c:37: splinefont.h:2880:19: note: previous declaration of 'SplinePointListInterpretGlif' was here extern SplineSet *SplinePointListInterpretGlif(SplineFont *sf,char *filename,char *memory, int memlen, int em_size, int ascent,int stroked);

解决方法

设置环境变量
vi /etc/profile

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

source /etc/profile

然后再重新执行 ./autogen.sh 和  ./configure 命令最后执行make 命令。

 make成功

最后执行 make install 命令。

2.3  编译安装转pdf2htmlEX

2.3.1 下载

wget https://github.com/coolwanglu/pdf2htmlEX/archive/master.zip

备注  如果提示 443... failed: Connection refused 多试几次就能下载 只要是不成功包括解压不成功等等都是文件下载不完整的问题多试几次直到文件成功下载下来 提示 saved 就是下载完整成功

2.3.2 解压安装

unzip master.zip
cd pdf2htmlEX-master/
cmake .
make && make install
ln -s /usr/local/lib/libfontforge.so.2 /lib64/libfontforge.so.2

PDF转html示例命令

pdf2htmlEX --fit-width 700 --optimize-text 1  --embed-external-font 0 --embed-javascript 0 --embed-outline 0  e77f01be-208c-44ab-9f04-26e74cd16735_3.pdf --dest-dir test
阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: centos