CentOS7安装swftools
链接:https://pan.baidu.com/s/1RdbEhOg5KxDcG_8oK-2kbQ
提取码:azjy
2.解压
tar -vxzf swftools-0.9.2.tar.gz
3.编译安装
yum install gcc* automake zlib-devel libjpeg-devel giflib-devel freetype-devel cd swftools-0.9.2 ./configure --prefix=/usr/local/swftools make make install
4.配置环境变量
# vim /etc/profile # 以下为文件添加内容,添加到文件最后 export PATH=$PATH:/usr/swftools/bin/ # 加载环境变量 source /etc/profile
5.安装xpdf-chinese-simplified.tar.gz 简体中文字体解析文件
将 xpdf-chinese-simplified.tar.gz 文件上传至 /usr/local/share/xpdf 目录中,如果没有 /usr/local/share/xpdf 目录则创建:
mkdir -p /usr/local/share/xpdf
解压并改名
cd /usr/local/share/xpdf tar -vxzf xpdf-chinese-simplified.tar.gz mv xpdf-chinese-simplified chinese-simplified # 包中CMap已包含gkai00mp.ttf和gbsn00lp.ttf字体文件
编辑add-to-xpdfrc文件
vim /usr/local/share/xpdf/chinese-simplified/add-to-xpdfrc # 内容如下 #----- begin Chinese Simplified support package (2011-sep-02) cidToUnicode Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode unicodeMap ISO-2022-CN /usr/local/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap unicodeMap EUC-CN /usr/local/share/xpdf/chinese-simplified/EUC-CN.unicodeMap unicodeMap GBK /usr/local/share/xpdf/chinese-simplified/GBK.unicodeMap cMapDir Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap toUnicodeDir /usr/local/share/xpdf/chinese-simplified/CMap displayCIDFontTT Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap/gbsn00lp.ttf displayCIDFontTT Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap/gkai00mp.ttf #fontFileCC Adobe-GB1 /usr/..../gkai00mp.ttf #----- end Chinese Simplified support package # 路径配置要正确
6.测试
pdf2swf -s languagedir=/usr/local/share/xpdf/chinese-simplified/ -T 9 -s poly2bitmap -s zoom=150 -s flashversion=9 test.pdf -o test.swf # languagedir=是xpdf语言包的路径 # test.pdf需要转的pdf # test.swf转换后的文件 # 下载test.swf打开正常显示为成功
7.常见报错
报错1
You need zlib to compile swftools
解决:zlib的组件没完全安装
yum install -y zlib-devel libjpeg-devel giflib-devel freetype-devel
报错2
Invalid configuration x86_64-unknown-linux-': machine
x86_64-unknown-linux'
解决:gcc没安装
yum install gcc -y
报错3
g++: Command not found
解决:g++没安装
yum install -y gcc-c++
报错4
在执行make install时报错, rm -f /usr/local/share/swftools/swfs/default_viewer.swf -o -L /usr/local/share/swftools/swfs/default_viewer.swf rm:无效选项 -- o 请尝试执行"rm --help"来获取更多信息。 make[1]: * [install] 错误 1 make[1]: Leaving directory `/root/swftools-0.9.2/swfs' make: * [install] 错误 2