zoukankan      html  css  js  c++  java
  • PlexPaper Practice

    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.

    1. Download and install SwfTools. All builds are available for download here.
    2. 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:SWFToolspdf2swf.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.

    1. Download and extract the pre-compiled version of FlexPaper. All builds are available for download here.
    2. 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.
    3. Copy the SWF you created with PDF2SWF to the same directory as your extracted files
    4. 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 at Adobe's web site.
    Using FlexPaper in Adobe Flex

    Using the viewer in Adobe Flex is as easy a using the flash version.

    1. Download the FlexPaper SWC from Google Code and add the FlexPaper library to your Flex project.
    2. 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>

    1.解决搜索高亮问题:

    搜索文字时可以搜素出相关的内容,但内容不能高亮,在查看官网的例子时发现是可以高亮的,仔细检查发现调用官方的API无误,应该可以排除代码的错误。 在仔细查看官网介绍“Large Documents”部分时有一行命令: C:SWFToolspdf2swf.exePaper.pdf-oPaper%.swf-f -T 9 -t -s storeallcharacters 刚开始看不懂,后来查看swftoos官网的文档时发现这几个参数大有讲究,大略翻译了一下:

    -f 字体应该被嵌入,能够改善swf搜索

    -T 9 设置转化的flash版本为9,提高swf的稳定性

    -t 在每一帧时插入停止,提高swf的稳定性

    -s storeallcharacters存储的文本文件中的所有字符信息,提高搜索能力 而上面命令行中的“%”则是将大文档转化为一页一页的,提高加载速度,是一个可选项。

    按照上面命令行转化的结果,再次搜索时发现搜素的文字的确可以高亮。

  • 相关阅读:
    springMVC后端返回数据到前端
    spring MVC配置
    SSM框架中配置静态资源加载
    js实践问题收集日记
    页面HTml学习笔记
    js页面传值实践
    struts2中jsp页面与action之间的传值
    json与Java对象的转换
    JDBC的简单应用
    新的开始,重新启用博客园
  • 原文地址:https://www.cnblogs.com/yefengmeander/p/3497854.html
Copyright © 2011-2022 走看看