博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux PDF转换为SWF
阅读量:6979 次
发布时间:2019-06-27

本文共 4775 字,大约阅读时间需要 15 分钟。

 由于工程需要把用户上传的PDF转换为SWF,服务器要求也是linux,所以就想到 swftools,官方网站:
可以把很多文件转换为swf,他默认只支持 英文,中文转换出来是乱码,所以我们要下载中文字库。中途遇到不少问题,都慢慢解决了,参数也明白了,大家看我的记载吧。
环境:
Server : ubuntu-server 8.0.4
software: xpdf-chinese-simplified.tar.gz   
##给操作系统安装中文字库
shell $> apt-get install language-support-fonts-zh
##安装软件
shell $> apt-get install swftools
shell $> wget 
shell $> wget 
解压 xpdf-chinese-simplified.tar.gz 修改配置文件
shell $> tar zxvf xpdf-chinese-simplified.tar.gz
shell $> unzip font.zip
shell $> mv Gbsn00lp.ttf gkai00mp.ttf xpdf-chinese-simplified/CMap/
##把 xpdf-chinese-simplified 移动到 /usr/share/xpdf
shell $> mkdir -p /usr/share/xpdf
shell $> mv xpdf-chinese-simplified /usr/share/xpdf
##修改配置文件
shell $> cd /usr/share/xpdf/xpdf-chinese-simplified
shell $> vim add-to-xpdfrc
#—– begin Chinese Simplified support package (2004-jul-27)
cidToUnicode    Adobe-GB1       /usr/share/xpdf/xpdf-chinese-simplified/Adobe-GB1.cidToUnicode
unicodeMap      ISO-2022-CN     /usr/share/xpdf/xpdf-chinese-simplified/ISO-2022-CN.unicodeMap
unicodeMap      EUC-CN          /usr/share/xpdf/xpdf-chinese-simplified/EUC-CN.unicodeMap
unicodeMap      GBK             /usr/share/xpdf/xpdf-chinese-simplified/GBK.unicodeMap
cMapDir         Adobe-GB1       /usr/share/xpdf/xpdf-chinese-simplified/CMap
toUnicodeDir                    /usr/share/xpdf/xpdf-chinese-simplified/CMap
displayCIDFontTT        Adobe-GB1       /usr/share/xpdf/xpdf-chinese-simplified/CMap/gkai00mp.ttf
#—– end Chinese Simplified support package
用winscp上传上来一个 pdf 转换看看。
shell $> ls
aa.pdf
##查看参数
shell $> pdf2swf –help
Usage: pdf2swf [Options] input.pdf [-o output.swf]
Basic options:
-p  –pages=range          Convert only pages in range
-P  –password=password    Use password for deciphering the pdf
-v  –verbose              Be verbose. Use more than one -v for greater effect
-q  –quiet                Suppress normal messages. Use -qq to suppress warnings, also.
-F  –fontdir directory    Add directory to font search path
-V  –version              Print program version
Enhanced conversion options:
-S  –shapes               Don’t use SWF Fonts, but store everything as shape
-z  –zlib                 Use Flash 6 (MX) zlib compression (Needs at least Flash 6 Plugin to play)
-w  –samewindow           Don’t open a new Browser Window for Links in the SWF
-f  –fonts                Store full fonts in SWF. (Don’t reduce to used characters)
-T  –flashversion=num     Set the flash version in the header to num (default: 4)
-s insertstop              Insert a “Stop” Tag in every frame (don’t turn pages automatically)
-s zoom=factor             Scale result, default: 72
-s jpegquality=quality     Set quality of embedded jpeg pictures (default:85)
-s caplinewidth=value      Set the minimum line width to trigger cap style handling to value. (3)
-s splinequality=value     Set the quality of spline convertion to value (0-100, default: 100).
-s fontquality=value       Set the quality of font convertion to value (0-100, default: 100).
-s ignoredraworder         Ignore draw order (makes the SWF file smaller and faster, but may produce
                           graphic errors)
-s filloverlap             Make intersecting shapes overlap, instead of canceling each
                           other out. (Needed for some Powerpoint PDFs)
Postprocessing options:
-b  –defaultviewer        Link default viewer to the pdf (/usr/share/swftools/swfs/default_viewer.swf)
-l  –defaultpreloader     Link default preloader the pdf (/usr/share/swftools/swfs/default_loader.swf)
-B  –viewer=filename      Link viewer “name” to the pdf (“pdf2swf -B” for list)
-L  –preloader=filename   Link preloader “name” to the pdf (“pdf2swf -L” for list)
shell $> pdf2swf -o as.swf -T -z -t aa.pdf -s languagedir=/usr/share/xpdf/xpdf-chinese-simplified -s flashversion=9
NOTICE  Adding /usr/share/xpdf/xpdf-chinese-simplified to language pack directories
NOTICE  Adding /usr/share/swftools/fonts to font directories
Title:        <unicode>
Author:       DoDoLo
Creator:      Acrobat PDFMaker 7.0 for Word
Producer:     Acrobat Distiller 7.0 (Windows)
CreationDate: 20070413230358-07′00′
ModDate:      20070413230457-07′00′
Pages:        177
Linearized:   yes
Encrypted:    no
NOTICE  processing PDF page 1 (595×842:0:0) (move:0:0)
Warning: glyph 0/22141 (unicode 0) has return code 20
NOTICE  file contains pbm pictures
NOTICE  processing PDF page 2 (595×842:0:0) (move:0:0)
NOTICE  Some texts will be rendered as shape
NOTICE  File contains links
NOTICE  processing PDF page 3 (595×842:0:0) (move:0:0)
Warning: glyph 0/22021 (unicode 0) has return code 20
NOTICE  processing PDF page 4 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 5 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 6 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 7 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 8 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 9 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 10 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 11 (595×842:0:0) (move:0:0)
NOTICE  processing PDF page 12 (595×842:0:0) (move:0:0)
……
NOTICE  SWF written
###随后用 winscp 拷贝到 windows 上查看转换是否成功
本文转自Deidara 51CTO博客,原文链接:http://blog.51cto.com/deidara/271533,如需转载请自行联系原作者
 
你可能感兴趣的文章
C++中public、protect和private用法区别
查看>>
LVM逻辑卷的缩减与删除,LVM逻辑卷快照,btrfs文件系统,网络管理
查看>>
git命令
查看>>
grails 常用修改
查看>>
Java 匿名类也能使用构造函数
查看>>
nginx系列:nginx反向缓存代理详解
查看>>
点击通知栏后打开Activity,并传参
查看>>
检查是否支持 SO_REUSEPORT
查看>>
Spring MVC配置
查看>>
JDBC连接各种数据库方法
查看>>
国际版Azure搭建Windows多种类型×××_三.配置SSTP ×××连接服务
查看>>
fullPage教程 -- 整屏滚动效果插件 fullpage详解
查看>>
Python 安装 xlsx模块
查看>>
周鸿祎在360新员工入职培训上的讲话
查看>>
鸟哥学习笔记---网络安全基础
查看>>
The Life Cycle of a Servlet
查看>>
spring mvc文件上传小例子
查看>>
spring cloud快速搭建
查看>>
PL/SQL --> INSTEAD OF 触发器
查看>>
XShell连接Deepin
查看>>