linux PDF转换为SWF

简介:

 由于工程需要把用户上传的PDF转换为SWF,服务器要求也是linux,所以就想到 swftools,官方网站:http://www.swftools.org/可以把很多文件转换为swf,他默认只支持 英文,中文转换出来是乱码,所以我们要下载中文字库。中途遇到不少问题,都慢慢解决了,参数也明白了,大家看我的记载吧。

环境:

Server : CentOS  6.5 

software: xpdf-chinese-simplified.tar.gz   font.zip

##安装SWFtools服务

安装过程:http://qiangsh.blog.51cto.com/3510397/1743074

##给操作系统安装中文字库

安装过程:http://qiangsh.blog.51cto.com/3510397/1743080

##安装软件

shell $> wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified.tar.gz

shell $> wget http://www.nginxs.com/download/font.zip

解压 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
test.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 test1.swf -T -z -t test.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 上查看转换是否成功

好了成功“大家试试吧!!

 

本文首发:www.nginxs.com

本文出自 “linuxer” 博客,请务必保留此出处http://deidara.blog.51cto.com/400447/271533

本文转自奔跑在路上博客51CTO博客,原文链接http://blog.51cto.com/qiangsh/1743059如需转载请自行联系原作者


qianghong000

相关文章
|
缓存 Linux Windows
Linux环境aspose插件word转pdf中文乱码解决方案
Linux环境aspose插件word转pdf中文乱码解决方案
1518 0
|
安全 Unix Linux
Linux 下的 10 个 PDF 软件
Linux 下的 10 个 PDF 软件
519 2
|
8月前
|
Linux C语言
探索Linux命令c2ph:将C代码转换为PostScript或PDF的奇妙工具
`c2ph`是Linux下的工具,能将C代码转换为PostScript或PDF,便于阅读和分享。通过pretty-print技术美化源代码。安装需从源码编译,使用`c2ph -o &lt;output&gt; &lt;source.c&gt;`生成PostScript文件,再用`ps2pdf`转为PDF。注意它可能不支持复杂格式设置,大型文件处理可能慢,且兼容性有限。适合偶尔需要打印代码副本的情况。
|
9月前
|
缓存 Linux Windows
Linux下安装宋体以及微软雅黑字体-转PDF后不显示中文,以及中文乱码
Linux下安装宋体以及微软雅黑字体-转PDF后不显示中文,以及中文乱码
958 0
|
缓存 Linux 数据安全/隐私保护
aspose win/linux WORD转PDF(及其解决乱码方式)
aspose win/linux WORD转PDF(及其解决乱码方式)
1525 1
|
Linux Windows
ceb2Pdf.exe实现ceb文件转pdf,内网离线安装wine(手动编译32位)实现在centos(linux)上运行window程序exe程序,解决wine : Z:\xxx EXE格式无效
最近项目需要实现ceb文件在线预览,之前并没见过这格式的文件,一搜发现果然不简单,这破东西还不太好弄在线预览,经过查找发现只有windows版本的cebToPdf.exe程序可以转换成pdf再进行预览,但是我们服务器是centos(内网)啊,所以就有了该篇文章。
707 0
|
Linux 数据安全/隐私保护 Windows
Linux中如何优雅的批量合并、拆分、加密pdf文件
在windows中合并个pdf还要让你冲会员,真的是狗。linux下有没有一款工具能完成对pdf的合并、切分的工具呢?
443 0
|
18天前
|
Linux
Linux系统之whereis命令的基本使用
Linux系统之whereis命令的基本使用
54 23
Linux系统之whereis命令的基本使用
|
3月前
|
Linux 网络安全 数据安全/隐私保护
Linux 超级强大的十六进制 dump 工具:XXD 命令,我教你应该如何使用!
在 Linux 系统中,xxd 命令是一个强大的十六进制 dump 工具,可以将文件或数据以十六进制和 ASCII 字符形式显示,帮助用户深入了解和分析数据。本文详细介绍了 xxd 命令的基本用法、高级功能及实际应用案例,包括查看文件内容、指定输出格式、写入文件、数据比较、数据提取、数据转换和数据加密解密等。通过掌握这些技巧,用户可以更高效地处理各种数据问题。
384 8
|
5天前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
54 25

热门文章

最新文章