[摘要:第一步:下载swftools-0.9.2.tar.gz 第两步:swftools tar -xzvf swftools-0.9.2.tar.gz cd swftools-0.9.2 ./configure make make install make clean make distclean whereis pdf2swf 常睹毛病: ①找没有到jpeg敕令 jpeg.c:462: error:]
第一步:下载swftools-0.9.2.tar.gz
第二步:swftools
tar -xzvf swftools-0.9.2.tar.gz
cd swftools-0.9.2
./configure
make
make install
make clean
make distclean
whereis pdf2swf
常见错误:
①找不到jpeg命令
jpeg.c:462: error: conflicting types for ‘jpeg_load_from_mem’
jpeg.h:15: note: previous declaration of ‘jpeg_load_from_mem’ was here
解决方案,
下载sjpegsrc.v9a.tar.gz
安装jpeg
tar -xzvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure
make
make install
make clean
make distclean
②出现未定义而去使用的错误:
:info:build jpeg.c:109:35: error: use of undeclared identifier 'TRUE'
:info:build jpeg_set_quality(&cinfo,quality,TRUE);
:info:build
解决方案,swftools-0.9.2 中一个文件做修改:
vi lib/jpeg.c
#ifdef HAVE_JPEGLIB
#define HAVE_BOOLEAN
#include
改为:
#ifdef HAVE_JPEGLIB
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define HAVE_BOOLEAN
#include
③找不到freetype命令错误
yum install freetype
④./lib/libgfx.a(gfxfont.o): In function `gfxfont_free':
gfxfont.c:(.text+0x56): undefined reference to `glyph_clear'
collect2: ld returned 1 exit status
make[1]: *** [swfrender] Error 1
make[1]: Leaving directory `/home/fz/swftools-0.9.1/src'
make: *** [all] Error 2
解决方案:
yum install freetype-devel
⑤可能遇到的问题
modules/.././types.h:39:2: 错误:#error "no way to define 64 bit integer"
modules/.././types.h:42:2: 错误:#error "don't know how to define 32 bit integer"
modules/.././types.h:45:2: 错误:#error "don't know how to define 16 bit integer"
modules/.././types.h:48:2: 错误:#error "don't know how to define 8 bit integer"
解决方法:
[root~]# ldconfig /usr/local/lib
然后再执行
[root~]# ./configure
make
make install
⑥ 还可能遇到的问题
make[1]: *** [install] 错误 1
make[1]: Leaving directory `/root/swftools-0.9.2/swfs'
make: *** [install] 错误 2
解决方法:
将swfs目录下的Makefile和Makefile.in两个文件中的 -o -L 去掉
make install
成功
安装完成后执行一下,pdf2swf -h 有帮助内容显示,则证明安装成功。
如果所转换的PDF不包含中文,则到此为止就可以正常使用了。
如果包含中文,就需要使用到xpdf的字体库
第三步:测试命令是否成功
pdf2swf -T 9 -s poly2bitmap -s zoom=150 -s flashversion=9 "/usr/local/app/xxxie/1.pdf" -o "/usr/local/app/xxxie/1.swf"
如果pdf2swf命令找不到,需要添加pdf2swf到环境变量中
vim /etc/profile
export PATH=$PATH:/usr/local/swftools/bin/
如果中文乱码,进行第四步
第四步:安装xpdf语言包。
到http://www.foolabs.com/xpdf/download.html下载xpdf-chinese-simplified.tar.gz
tar -xzvf xpdf-chinese-simplified.tar.gz
解压到任意路径,例如/usr/local/xpdf/xpdf-chinese-simplified
下载
http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/gkai00mp.ttf.gz
http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/gbsn00lp.ttf.gz
解压出ttf文件gkai00mp.ttf和gbsn00lp.ttf,放到/usr/local/xpdf/xpdf-chinese-simplified/CMap/路径下
5. 配置/usr/local/xpdf/xpdf-chinese-simplified/add-to-xpdfrc文件
#----- begin Chinese Simplified support package (2011-sep-02)
cidToUnicode Adobe-GB1 /usr/local/xpdf/xpdf-chinese-simplified/Adobe-GB1.cidToUnicode
unicodeMap ISO-2022-CN /usr/local/xpdf/xpdf-chinese-simplified/ISO-2022-CN.unicodeMap
unicodeMap EUC-CN /usr/local/xpdf/xpdf-chinese-simplified/EUC-CN.unicodeMap
unicodeMap GBK /usr/local/xpdf/xpdf-chinese-simplified/GBK.unicodeMap
cMapDir Adobe-GB1 /usr/local/xpdf/xpdf-chinese-simplified/CMap
toUnicodeDir /usr/local/xpdf/xpdf-chinese-simplified/CMap
displayCIDFontTT Adobe-GB1 /usr/local/xpdf/xpdf-chinese-simplified/CMap/gkai00mp.ttf
displayCIDFontTT Adobe-GB1 /usr/local/xpdf/xpdf-chinese-simplified/CMap/gbsn00lp.ttf
#----- end Chinese Simplified support package
测试命令是否成功
pdf2swf -s languagedir=/usr/local/xpdf-chinese-simplified -T 9 -s poly2bitmap -s zoom=150 -s flashversion=9 "/usr/local/app/xxxie/1.pdf" -o "/usr/local/app/xxxie/1.swf"
本文转自奔跑在路上博客51CTO博客,原文链接http://blog.51cto.com/qiangsh/1743074如需转载请自行联系原作者
qianghong000