Install and configure swftools in CentOS
1. install required libraries and components.
yum install gcc* automake zlib-devel libjpeg-devel giflib-devel freetype-devel
2. Download, compile, and install swftools.
wgethttp://www.swftools.org/swftools-0.9.2.tar.gz
tar vxzf swftools-
0.9
.
2
.tar.gz
cd swftools-
0.9
.
2
./configure --prefix=/usr/local/swftools
make
make install
3. Set swftools Environment Variables
vim /etc/profile
export PATH=$PATH:/usr/swftools/bin/
4. Install the xpdf Language Pack.
Download the xpdf-chinese-simplified.tar.gz file, decompress it to/usr/share/xpdf, and edit the add-to-xpdfrc file (download the Gbsn00lp. ttf gkai00mp. ttf font), as follows:
Tar zxvf xpdf-chinese-simplified.tar.gz
Unzip font.zip
Mv Gbsn00lp. ttf gkai00mp. ttf xpdf-chinese-simplified/CMap/
Cd/usr/share/xpdf-chinese-simplified
Vim add-to-xpdfrc
The content is as follows:
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
Save and exit
5. Run the following command to test the conversion:
pdf2swf -s languagedir=/usr/share/xpdf/xpdf-chinese-simplified -T 9 -s poly2bitmap -s zoom=150 -s flashversion=9 "/opt/123.pdf" -o "/opt/test/%.swf"
Conversion successful! Done!
Appendix: Linux environment configuration file
openOfficeStartCommand = /usr/lib/openoffice.org3/program/soffice.bin/ -headless\ -accept="socket,host=127.0.0.1,port=8100;urp;"\ -nofirststartwizard
pdfToSwfCommand = /usr/local/swftools/bin/pdf2swf
bitMapc=-T 9 -s poly2bitmap -s zoom=150
zoom=150
langc=-s languagedir=/usr/share/xpdfl/xpdf-chinese-simplified
port = 8100