---
title: "swftools linux下安装"
author: "dendy"
date: "2014-08-21T14:38:00Z"
tags: []
slug: "swftools-linux"
draft: false
lastmod: "2015-04-21T22:14:01Z"
id: 2204654
url: "https://dendy.iteye.com/blog/2204654"
---

1、下载：

[http://www.swftools.org/download.html](http://www.swftools.org/download.html)

文件为：swftools-0.9.2.tar.gz

安装文档：

http://wiki.swftools.org/wiki/Installation#How\_to\_compile.2Flink\_swftools\_on\_Unix.2FLinux.2FBSD.3F

2、解压：

tar -xzfswftools-0.9.2.tar.gz

解压后得到文件夹：

swftools-0.9.2

3、安装中文支持

中文支持安装：

1）mkdir –p /usr/share/xpdf

cd /usr/share/xpdf/

2）下载中文支持及字体库

wgetftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified.tar.gz

wgethttp://www.nginxs.com/download/font.zip

3）tar zxvf xpdf-chinese-simplified.tar.gz

unzip font.zip

mv Gbsn00lp.ttf gkai00mp.ttf xpdf-chinese-simplified/CMap/

cd /usr/share/xpdf/xpdf-chinese-simplified

4）vi add-to-xpdfrc

内容如下：

cidToUnicodeAdobe-GB1/usr/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode

unicodeMapISO-2022-CN/usr/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap

unicodeMapEUC-CN/usr/share/xpdf/chinese-simplified/EUC-CN.unicodeMap

unicodeMapGBK/usr/share/xpdf/chinese-simplified/GBK.unicodeMap

cMapDirAdobe-GB1/usr/share/xpdf/chinese-simplified/CMap

toUnicodeDir/usr/share/xpdf/chinese-simplified/CMap

displayCIDFontTT Adobe-GB1 /usr/share/xpdf/chinese-simplified/CMap/gkai00mp.ttf

保存后退出

4、相关Lib包安装:

1）yum –y install gcc-c++(如果已安装可跳过)

2）yum install giflib-devel.x86\_64

3）yum install zlib-devel.x86\_64

4）yum install freetype-devel.x86\_64

5）yum install libjpeg-devel.x86\_64

5、SwfTool安装：

1）cd /usr/local/

2）wgethttp://www.swftools.org/swftools-0.9.1.tar.gz

3）tar zxvf swftools-0.9.1.tar.gz

4）cd swftools-0.9.1

5）./configure --prefix=/usr/local/swftools/，可能报错，需要添加--build=i686-pc-linux-gnu：

./configure --prefix=/usr/local/swftools/--build=i686-pc-linux-gnu

6）make

7）make install

8）测试一下是否可用

pdf2swf -o /path/output.swf -T -z -t -f /path/yourpdffile.pdf -s languagedir=/usr/share/xpdf/xpdf-chinese-simplified -s flashversion=9

官方文档：

## How to compile/link swftools on Unix/Linux/BSD?

Some distributions of Linux have swftools available in their standard repositories. In this case, installation is immediate: just use the package manager and order it to install swftools. For example, those that use*yum*it will just require the command (as root)*yum install swftools*, those with*urpmi*just*urpmi swftools*, etc. If this does not work, try the method below (beware of dependency hell!)

Download swftools-0.x.x.tar.gz. Then type, on the command-line:

```
   tar -zvxf swftools-0.x.x.tar   cd swftools-0.x.x   ./configure   make    make install
```

(you will have to be root for the last step)

What libraries do I need to compile swftools on Unix/Linux/BSD?

You need freetype and jpeglib to compile pdf2swf. Links:

```
 * freetype: http://www.freetype.org * jpeglib:  http://www.ijg.org/files/
```

NB jpeglib is now at version 8. Version 6, appears to be no longer available. Should you happen to know a link, please post it here.

```
 libjpeg-6a can be found here - ftp://sunsite.unc.edu/pub/Linux/libs/graphics/ libjpeg 6b1-2 debs here - http://packages.debian.org/search?keywords=libjpeg6
```

For the later versions you will also need to place the tar g'zipped distribution of[xpdf](ftp://ftp.foolabs.com/pub/xpdf/)in the lib/pdf folder of the unpacked SWFTools distribution, i.e.

```
 * cd swftools/lib/pdf * wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.03.tar.gz * cd ../../ * ./configure [ -- your_compiler_flags ]
```

When compiling, configure might give the following error -

```
 checking for missing libraries...  ungif gif_lib.h *************************************************** * The following headers/libraries are missing:  ungif gif_lib.h * Disabling gif2swf tool... ***************************************************
```

ungif may no longer be used in your distro.

libgif-dev is the new build package, use this instead.

When compiling the sourcecode version, configure doesn't find my jpeglib!

In case some of your libraries/include files are installed in /usr/local, try the following:

```
 rm -f config.cache LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure
```

Furthermore, a new installation of jpeglib (the following assumes it's in /usr/local/lib) often requires doing a:

```
 ranlib /usr/local/lib/libjpeg.a ldconfig /usr/local/lib
```

In order to install jpeglib, it's furthermore been remarked that you need to do:

```
 make install-lib make install-headers
```

If it still doesn't work, try removing the file "config.cache" before running configure again.

There are problems during compilation

Error messages complain about "undefined reference to \`operator new(unsigned)'" as well as "undefined reference to \`\_\_gxx\_personality\_v0'".

Try running configure as

```
 LDFLAGS=-lstdc++ ./configure
```