一 、FlexPaper
FlexPaper是一个开源轻量级的文档浏览组件,可以与PDF2SWF一起使用,其中显示的文档应被转换为SWF格式。 FlexPaper可以使用在web页面或Flex中。
FlexPaper主页http://flexpaper.devaldi.com 。
<script type="text/javascript" src="js/flexpaper_flash.js"></script>
<div style="position:absolute;left:10px;top:10px;">
<a id="viewerPlaceHolder" style="width:660px;height:480px;display:block"></a>
'FlexPaperViewer',
'viewerPlaceHolder', { config : {
SwfFile : 'Paper.swf',
Scale : 0.6,
ZoomTransition : 'easeOut',
ZoomTime : 0.5,
ZoomInterval : 0.2,
FitPageOnLoad : true,
FitWidthOnLoad : false,
PrintEnabled : true,
FullScreenAsMaxWindow : false,
ProgressiveLoading : false,
MinZoomSize : 0.2,
MaxZoomSize : 5,
SearchMatchAll : false,
InitViewMode : 'Portrait',
ViewModeToolsVisible : true,
ZoomToolsVisible : true,
NavToolsVisible : true,
CursorToolsVisible : true,
SearchToolsVisible : true,
localeChain: 'en_US'
}});
</script>
</div>
在Flex中使用
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" xmlns:fp="com.devaldi.controls.flexpaper.*">
<fp:FlexPaperViewer width="520" height="450" Scale="0.6" SwfFile="Paper.swf" />
</mx:Application>
二、SWFTools
SWFTools 是处理SWF文件的工具集。
SWFTools主页http://www.swftools.org ,当前最新版本为0.9.2,其中包含以下工具:
PDF2SWF A PDF to SWF Converter. Generates one frame per page. Enables you to have fully formatted text, including tables, formulas, graphics etc. inside your Flash Movie. It's based on the xpdf PDF parser from Derek B. Noonburg.
SWFCombine A multi-function tool for inserting SWFs into Wrapper SWFs, contatenating SWFs, stacking SWFs or for basic parameter manipulation (e.g. changing size).
SWFStrings Scans SWFs for text data.
SWFDump Prints out various informations about SWFs, like contained images/fonts/sounds, disassembly of contained code as well as cross-reference and bounding box data.
JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow from them. Supports motion estimation compression (h.263) for better compression of video sequences.
PNG2SWF Like JPEG2SWF, only for PNGs.
GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs.
WAV2SWF Converts WAV audio files to SWFs, using the L.A.M.E. MP3 encoder library.
AVI2SWF Converts AVI animation files to SWF. It supports Flash MX H.263 compression. Some examples can be found at examples.html. (Notice: this tool is not included anymore in the latest version, as ffmpeg or mencoder do a better job nowadays)
Font2SWF Converts font files (TTF, Type1) to SWF.
SWFBBox Allows to read out, optimize and readjust SWF bounding boxes.
SWFC A tool for creating SWF files from simple script files. Includes support for both ActionScript 2.0 as well as ActionScript 3.0.
SWFExtract Allows to extract Movieclips, Sounds, Images etc. from SWF files.
AS3Compile A standalone ActionScript 3.0 compiler. Mostly compatible with Flex.
pdf2swf 参数说明
example:
命令行 pdf2swf Paper.pdf -o Paper.swf -T 9 -f
java调用 Runtime.getRuntime().exec(cmd)
-h , --help Print short help message and exit
-V , --version Print version info and exit
-o , --output file.swf Direct output to file.swf. If file.swf contains '%' (file%.swf), then each page goes to a seperate file.
-p , --pages range Convert only pages in range with range e.g. 1-20 or 1,4,6,9-11
-P , --password password Use password for deciphering the pdf.
-v , --verbose Be verbose. Use more than one -v for greater effect.
-z , --zlib Use Flash 6 (MX) zlib compression.
-i , --ignore Allows pdf2swf to change the draw order of the pdf. This may make the generated
-j , --jpegquality quality Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)
-s , --set param=value Set a SWF encoder specific parameter. See pdf2swf -s help for more information.
-w , --samewindow When converting pdf hyperlinks, don't make the links open a new window.
-t , --stop Insert a stop() command in each page.
-T , --flashversion num Set Flash Version in the SWF header to num.
-F , --fontdir directory Add directory to the font search path.
-b , --defaultviewer Link a standard viewer to the swf file.
-l , --defaultloader Link a standard preloader to the swf file which will be displayed while the main swf is loading.
-B , --viewer filename Link viewer filename to the swf file.
-L , --preloader filename Link preloader filename to the swf file.
-q , --quiet Suppress normal messages. Use -qq to suppress warnings, also.
-S , --shapes Don't use SWF Fonts, but store everything as shape.
-f , --fonts Store full fonts in SWF. (Don't reduce to used characters).
-G , --flatten Remove as many clip layers from file as possible.
-I , --info Don't do actual conversion, just display a list of all pages in the PDF.
-Q , --maxtime n Abort conversion after n seconds. Only available on Unix.
三、 Microsoft Office 2007 插件: Microsoft Save as PDF or XPS
该插件支持Word 、Excel 、Access 、PowerPoint 、InfoPath 、OneNote 、Publisher 和 Visio 。将相应文档存储为PDF 格式或XPS 格式。 可惜excel转换后不能保持原有样式。
下载地址http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=7
Office 2010本身就支持保存为PDF格式,不需要安装插件。