這次Linux下實如今線瀏覽功能已投入生產環境,生產環境是Centos6.4。javascript
一、下載jodconverter壓縮包,將相應jar包添加到工程目錄下。css
https://code.google.com/p/jodconverter/downloads/listhtml
二、下載安裝openoffice。http://www.openoffice.org/java
在openoffice下的RPMS目錄下執行rpm -ivh *.rpmjquery
在RPMS目錄下的desktop-integration文件夾中執行rpm -ivh openoffice4.0-redhat-menus-4.0-9714.noarch.rpmexpress
三、下載安裝swftools。http://www.swftools.org/download.htmljsp
tar -zxvf swftools-0.9.1.tar.gzflex
cd swftools-0.9.1優化
./configureui
make
make install
四、代碼實現網上有許多,可是大多存在問題。綜合網上衆多博文,本身對網上代碼作了些優化,轉化效率獲得很大提高,解決了卡進程的問題。源代碼後期貼出。
五、頁面展現採用Flexpaper。
要注意的是flexpaper引用的swf文件存放目錄要設置好,flexpaper.js文件中有變量指向flexpaper應用的swf文件。
window[instance] = flashembed(id, { src : _jsDirectory+"../FlexPaperViewer.swf", version : [10, 0], expressInstall : "js/expressinstall.swf", wmode : _WMode }
目錄結構:
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="css/flexpaper.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/flexpaper.js"></script> <script type="text/javascript" src="js/flexpaper_handlers.js"></script> </head> <body> <div id="documentViewer" class="flexpaper_viewer" style="width:770px;height:500px"></div> <script type="text/javascript"> var startDocument = "Paper"; $('#documentViewer').FlexPaperViewer( { config : { SWFFile : 'swf/aa.swf', Scale : 0.6, ZoomTransition : 'easeOut', ZoomTime : 0.5, ZoomInterval : 0.2, FitPageOnLoad : true, FitWidthOnLoad : false, FullScreenAsMaxWindow : false, ProgressiveLoading : false, MinZoomSize : 0.2, MaxZoomSize : 5, SearchMatchAll : false, InitViewMode : 'Portrait', RenderingOrder : 'flash', StartAtPage : '', ViewModeToolsVisible : true, ZoomToolsVisible : true, NavToolsVisible : true, CursorToolsVisible : true, SearchToolsVisible : true, WMode : 'window', localeChain: 'en_US' }} ); </script> </body> </html>