swftools可以将pdf文件转换成swf,这样可以直接用flexpaperviewer展示swf,
安装好后可以用java调用linux上命令生成swf即可。
将swf-tools0.9.2安装到home/pdf2swf
首先上传swf-tools0.9.2.tar.gz到服务器/home/swftools目录
1 安装依赖组件:
命令为 :#yum install gcc* automakezlib-devel libjpeg-devel giflib-devel freetype-devel
2等第一步执行完后, 进入上传文件的解压路径
#cd swf-tools0.9.2
执行configure配置安装路径
#./configure --prefix=/home/pdf2swf
如果出现一下错误,原因是第一步lib包没装好,重装即可。
checking for missinglibraries... ungif freetype gif_lib.h
checking for Pythonversion...
***************************************************
* The followingheaders/libraries are missing: ungif freetype gif_lib.h
* Disabling pdf2swftool...
* Disabling gif2swftool...
解决办法为重新安装lib库
3 配置安装路径后,就可以编译了,执行命令
#make
make问题如果出现以下问题
./simple_viewer || true
./simple_viewer: errorwhile loading shared libraries: libmp3lame.so.0: cannot open shared objectfile: No such file or directory
Calling ./simple_viewerto create simple_viewer.swf
./keyboard_viewer ||true
./keyboard_viewer:error while loading shared libraries: libmp3lame.so.0: cannot open sharedobject file: No such file or directory
Calling ./PreLoaderTemplateto create PreLoaderTemplate.swf
./PreLoaderTemplate ||true
./PreLoaderTemplate:error while loading shared libraries: libmp3lame.so.0: cannot open sharedobject file: No such file or directory
make[1]: Leavingdirectory `/home/swftools/swftools-0.9.2/swfs'
make[1]: Enteringdirectory `/home/swftools/swftools-0.9.2'
make[1]: Leavingdirectory `/home/swftools/swftools-0.9.2'
解决方法如下:
[root@master etc]# locatelibmp3lame.so.0
/root/soft-source/lame-3.99.5/libmp3lame/.libs/libmp3lame.so.0
/root/soft-source/lame-3.99.5/libmp3lame/.libs/libmp3lame.so.0.0.0
/usr/local/lib/libmp3lame.so.0
/usr/local/lib/libmp3lame.so.0.0.0
将路径/usr/local/lib/添加到/etc/ld.so.conf文件中,修改完文件后,以root身份运行 /sbin/ldconfig-v这时重新运行自己的程序,就没有问题了。
3编译通过后就可以安装了执行命令
#make install
如果出现以下提示信息:说明安装脚本的rm命令不正确,找到修改即可。
cd swfs;make install
/usr/local/share/swftools/swfs/tessel_loader.swf
/usr/bin/install -c -m 644 ./swft_loader.swf/usr/local/share/swftools/swfs/swft_loader.swf
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`/home/swftools/swftools-0.9.2/swfs'
make: *** [install]错误
解决方法如下:
find ./ |xargs grep -r -i"default_viewer"通过上面的命令可以找到下面的文件
[root@localhost swftools-0.9.2]# find ./|xargs grep -r -i default_viewer
./swfs/Makefile: rm -f$(pkgdatadir)/swfs/default_viewer.swf -o -L $(pkgdatadir)/swfs/defaut_viewer.swf
./swfs/Makefile: $(LN_S)$(pkgdatadir)/swfs/simple_viewer.swf $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile: $(UNINSTALL_DATA)$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: rm -f$(pkgdatadir)/swfs/default_viewer.swf -o -L$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: $(LN_S) $(pkgdatadir)/swfs/simple_viewer.swf$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: $(UNINSTALL_DATA)$(pkgdatadir)/swfs/default_viewer.swf
./src/pdf2swf.c: sprintf(buf,"%s/default_viewer.swf", SWFDIR);
./src/pdf2swf.1: The viewer swf to be usedis determined by a symlink named "default_viewer.swf" in
匹配到二进制文件 ./src/pdf2swf.o
匹配到二进制文件 ./src/pdf2swf
./swfs/Makefile: rm -f$(pkgdatadir)/swfs/default_viewer.swf -o -L$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile: $(LN_S)$(pkgdatadir)/swfs/simple_viewer.swf $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile: $(UNINSTALL_DATA)$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: rm -f$(pkgdatadir)/swfs/default_viewer.swf -o -L $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: $(LN_S)$(pkgdatadir)/swfs/simple_viewer.swf $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: $(UNINSTALL_DATA)$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile: rm -f$(pkgdatadir)/swfs/default_viewer.swf -o -L$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile: $(LN_S)$(pkgdatadir)/swfs/simple_viewer.swf $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile: $(UNINSTALL_DATA)$(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: rm -f $(pkgdatadir)/swfs/default_viewer.swf-o -L $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: $(LN_S)$(pkgdatadir)/swfs/simple_viewer.swf $(pkgdatadir)/swfs/default_viewer.swf
./swfs/Makefile.in: $(UNINSTALL_DATA)$(pkgdatadir)/swfs/default_viewer.swf
./src/pdf2swf.c: sprintf(buf,"%s/default_viewer.swf", SWFDIR);
./src/pdf2swf.1: The viewer swf to be usedis determined by a symlink named "default_viewer.swf" in
匹配到二进制文件 ./src/pdf2swf.o
匹配到二进制文件 ./src/pdf2swf
./src/pdf2swf.c: sprintf(buf,"%s/default_viewer.swf", SWFDIR);
./src/pdf2swf.1: The viewer swf to be usedis determined by a symlink named "default_viewer.swf" in
匹配到二进制文件 ./src/pdf2swf.o
匹配到二进制文件 ./src/pdf2swf
[root@localhost swftools-0.9.2]# viswfs/Makefile.in
分别修改上面红色标注的2个文件, 将-o -L去掉; 然后在执行make install 成功!