采用方法是将word->pdf->swf,之后用swfobject在线预览swf文件。
下面是必备环境:
a. 如果windows里没有安装OpenOffice,先安装该软件,该软件是与该文档相同目录下的OpenOffice_3.3.0_Win_x86_install-wJRE_zh-CN.exe。
b. 如果windows里没有安装Pdf2swf,先安装该软件,该软件是在该文档相同目录下的swftools-0.9.1.exe。在环境变量的系统变量里添加swftools的路径,如下图:
c. 用cmd打开cmd.exe,在下面输入如下命令来启动openOffice:
cd C:\Program Files\OpenOffice.org 3\program
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
另外自己借助于openoffice和jodconverter以及swftools写了一个小java程序,将pdf->swf。
接下来是使用swfobject:
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>系统使用文档在线浏览</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="src/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {
SwfFile : "src/handle.swf",
Scale : 0.6,
ZoomTransition : "easeOut",
ZoomTime : 0.5,
ZoomInterval : 0.1,
FitPageOnLoad : true,
FitWidthOnLoad : true,
PrintEnabled : true,
FullScreenAsMaxWindow : true,
ProgressiveLoading : true,
localeChain: "en_US"
};
var params = {
}
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
swfobject.embedSWF("FlexPaperViewer.swf", "myContent", "100%", "100%", "9.0.0", "expressInstall.swf",flashvars,params);
</script>
</head>
<body style="margin:20px 50px 10px 50px;height:800px;">
<form id="saveForm" name="saveForm" action="${ctxPath}SysHelpAction.do?method=download" method="post">
<div id="download" >
<input type="button" class="nor_button" value="下载" οnclick="submitForm('saveForm','${ctxPath}SysHelpAction.do?method=download')"/>
</div>
</form>
<div id="myContent">
</div>
</body>
</html>