FlexPaper_1.2.1.swc——Flex在线显示PDF文档(使用FlexPaper)感悟
http://www.cnblogs.com/wuhenke/archive/2010/03/16/1686885.html
想想自己先前搞PDF转SWF,然后在线浏览功能时,实在是费了不少精力。后来不断发现实现类似功能的网站:http://www.doc88.com/ 和 http://www.docin.com/ 虽然他们做的都比我起初做的好,但他们都是公司实力支撑,依靠的也是那种盈利模式。
自己的也在逐步完善和改进中,下面是我项目中的最终版:

一直希望在项目结束后,分享我的代码和心得。前天碰巧看到有外国网友,将该功能封装成SWC,实现技术路线都是相同的,现在大家可以学习一下,很方便地实现自己的PDF在线浏览功能了。(功能还不错,但有待提高!如下:)

网站地址:
http://flexpaper.devaldi.com/index.php
介绍转载:
Introduction
FlexPaper is an open source light weight document viewer component designed to work together with libraries such as PDF2SWF, making it possible to display PDF files in Adobe Flex and other Flash based applications.
Making your document ready
To make it possible for your users to view your PDF documents without using Acrobat Reader, documents first needs to be converted to the SWF file format. There is a range of available converters, both commercial and free. The following example uses the open source tool SwfTools and can be automated if needed.
- Download and install SwfTools. All builds are available for download here.
- Convert your PDF to SWF. This is preferrably done from the command prompt. Make sure you set your options (Edit->Options) to "No viewer" if you are converting your PDF using the UI from SwfTools before exporting your PDF to SWF. This example converts a PDF file called "Paper3.pdf" to the output file "Paper3.swf":
C:\SWFTools\pdf2swf.exe Paper3.pdf -o Paper3.swf
Please see the wiki for more details about the conversion and the parameters that are currently recommended.
Viewing your document using the pre compiled flash version
The pre-compiled version of FlexPaper is most useful if you just want to use FlexPaper on any of your web pages.
- Download and extract the pre-compiled version of FlexPaper. All builds are available for download here.
- The zip file contains a sample file called "FlexPaperViewer.html" which shows you the basic parameters you need to pass to FlexPaper (SwfFile and Scale). Please see the wiki on Google Code for a complete list of available parameters.
- Copy the SWF you created with PDF2SWF to the same directory as your extracted files
- Upload everything to your web site and navigate to FlexPaperViewer.html in your favorite browser. If you on the other hand would like to run the application from a local directory rather than from a web server, then the application has to be added as trusted first. You can do that atAdobe's web site.
Using FlexPaper in Adobe Flex
Using the viewer in Adobe Flex is as easy a using the flash version.
- Download the FlexPaper SWC from Google Code and add the FlexPaper library to your Flex project.
- Copy the SWF you created with PDF2SWF to your bin-debug directory and add the FlexPaper component to your flex application as in the following example (update the SwfFile property on the component to point to your SWF file):
<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="Paper3.swf" /> </mx:Application>
国内介绍该控件库的先驱:
http://wangcheng.javaeye.com/blog/549074
转载其博客内容:
FlexPaper是一个开源的轻量级文档显示组件,被设计用来与PDF2SWF一起使用,使在Flex中显示PDF成为可能。它可以被当做Flex的library来使用。
一. 使用PDF2SWF准备好你的文档
首先要将PDF转成SWF,这步可以使用开源的SwfTools自动完成
1.下载安装 SwfTools,当前最新版本是0.9
2. 转换PDF到SWF,可以通过命令行的方式,例如将Paper3.pdf转换成Paper3.swf
C:\SWFTools\pdf2swf Paper3.pdf -o Paper3.swf
二. 使用已经编译好的FlexPaper的flash版本浏览你的文档
- 下载并解压出已经编译好的FlexPaper
- zip文件包含一个例子文件叫做FlexPaperViewer.html,它向你展示了需要传给FlexPaper的基本参数
- var params = {
- SwfFile : "Paper.swf",
- Scale : 0.6
- }
- swfobject.embedSWF("FlexPaperViewer.swf","cb","500","500","9.0.0","js/swfobject/expressInstall.swf", params);
- //SwfFile参数是你想显示的文件,Scale是0-1之间的数,表示显示的放大参数
- 复制你创建出来的swf和PDF2SWF到解压缩出的相同目录
- 确定你添加了FlexPaperViewer.swf
三. 在Flex中使用FlexPaper
1. 下载FlexPaper SWC,添加到你的Flex项目libs中
2. 复制你用PDF2SWF创建的SWF到你的bin-debug目录,如Paper3.swf,添加FlexPaper组件到你的flex代码中
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="absolute"
- width="800" height="500"
- xmlns:flexpaper="com.devaldi.controls.flexpaper.*">
- <flexpaper:FlexPaperViewer width="800" height="500"
- Scale="1" SwfFile="Paper3.swf" />
- </mx:Application>
原文 http://www.devaldi.com/?page_id=260
SwfTools http://www.swftools.org/download.html
flexpaper http://code.google.com/p/flexpaper/
另外附 我推荐的参考资料网址:
http://wiki.swftools.org/index.php/Main_Page#SWF_API_Documentation
http://wiki.swftools.org/index.php/Pdf2swf
http://wiki.swftools.org/index.php/How_do_I_create_a_AVM2_compatible_SWF%3F
http://wiki.swftools.org/index.php/How_do_I_highlight_text_in_the_SWF%3F
FlexPaper_1.2.1.swc——Flex在线显示PDF文档(使用FlexPaper)感悟的更多相关文章
- 转:在 C# 中使用 P/Invoke 调用 Mupdf 函数库显示 PDF 文档
在 C# 中使用 P/Invoke 调用 Mupdf 函数库显示 PDF 文档 一直以来,我都想为 PDF 补丁丁添加一个 PDF 渲染引擎.可是,目前并没有可以在 .NET 框架上运行的免费 PDF ...
- java实现在线浏览PDF文档功能
实现在线浏览pdf文档功能(本代码适用于项目服务中固定的并且少量的pdf浏览,比如注册时的注册条款在线浏览等): //设置响应内容类型为PDF类型 response.setContentType(&q ...
- 手把手教你使用 Java 在线生成 pdf 文档
一.介绍 在实际的业务开发的时候,研发人员往往会碰到很多这样的一些场景,需要提供相关的电子凭证信息给用户,例如网银/支付宝/微信购物支付的电子发票.订单的库存打印单.各种电子签署合同等等,以方便用户查 ...
- 如何突出显示PDF文档中的一些重要文本信息
PDF文档中如果存在着太多的文字时,阅读者会容易遗漏很多重要的信息.但如果,文档中存在着一些特殊标记的文字时,比如标黄.标红文本时,很多人都会给予特别关注. 因此,当大家在使用pdfFactory专业 ...
- [转载]Java在线打开PDF文档
步骤一:(涉及到的工具) 访问:http://www.zhuozhengsoft.com/dowm/,从官网下载PageOffice for Java. 步骤二:(配置工程) 1. 解压PageOff ...
- [原创]java在线打开PDF文档
步骤一:(涉及到的工具) 访问:http://www.zhuozhengsoft.com/dowm/,从官网下载PageOffice for Java. 步骤二:(配置工程) 1. 解压PageOff ...
- java 使用 pdf.js 在线查看 pdf 文档
1. 下载对应的 pdf.js 文件: 推荐地址: https://github.com/mozilla/pdf.js/ http://mozilla.g ...
- 如何在在网页上显示pdf文档
------解决方案--------------------通过flash插件 ------解决方案--------------------RAD PDF Release 2.7 http://www ...
- 在线查看PDF文档
http://www.cnblogs.com/morang/p/4598894.html http://78re52.com1.z0.glb.clouddn.com/resource%2Fscenar ...
随机推荐
- Python 数据类型:元组
一.元组介绍 1. 元组可以存储一系列的值,使用括号来定义,每个元素之间用逗号隔开,形如 ('a', 'b', 'c', 'd')2. 元组一旦定义,元组内的元素就不能再修改,除非重新定义一个新的元组 ...
- js里面函数的内部属性
1.arguments用來存放传输参数的集合,可以被调用多次,每次数組都不一样,增强了函数的强壮性 实例: function calc() { var sum = 0; /*参数为一个时候*/ if ...
- 一加氢OS发布会 观看小结
观看地址:http://v.youku.com/v_show/id_XMTI0ODkzNTg5Mg==.html?from=s1.8-1-1.2八种基本色调.33%自由:top33%位置放壁纸,底部桌 ...
- web基础----->模板引擎Velocity的使用(一)
Velocity 是一个基于 Java 的模板引擎框架,提供的模板语言可以使用在 Java 中定义的对象和变量上.今天我们就学习一下Velocity的用法. Velocity的第一个例子 项目的主体是 ...
- JavaWeb温习之Cookie对象
1. 会话的概念 会话可简单理解为:用户开一个浏览器,点击多个超链接,访问服务器多个web资源,然后关闭浏览器,整个过程称之为一个会话.有状态会话:一个同学来过教室,下次再来教室,我们会知道这个同学曾 ...
- call和apply方法
/* * @ call和apply方法 * @ 当一个object没有某个方法,但是其他的有,我们可以借助call或apply用其它对象的方法来操作. * @ (有方法的)对象.call(" ...
- 神兽保佑-代码无BUG
┏┓ ┏┓┏┛┻━━━┛┻┓┃ ┃ ┃ ━ ┃┃ ┳┛ ┗┳ ┃┃ ┃┃ ┻ ┃┃ ┃┗━┓ ┏━┛ ┃ ┃ 神兽保佑 ┃ ┃ 代码无BUG! ┃ ┗━━━┓ ┃ ┣┓ ...
- Ant教程
安装ant,去http://ant.apache.org下载 配置环境变量(前提是配置了java环境变量) ANT_HOME G:\Software\ant1.9.7 //ant根目录 在PATH后添 ...
- 02Del.ashx(删除班级)
using System; using System.Collections.Generic; using System.Linq; using System.Web; using WebHelper ...
- pta 习题集 数列求和-加强版
给定某数字AA(1≤A≤91≤A≤9)以及非负整数NN(0≤N≤1000000≤N≤100000),求数列之和S=A+AA+AAA+⋯+AA⋯AS=A+AA+AAA+⋯+AA⋯A(NN个AA).例如A ...