onlypdfview.jsp
3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<%@ page import="weaver.docs.pdf.docpreview.ConvertPDFTools"%>
<%@ page import="weaver.general.*"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<link rel="stylesheet" href="/css/init_wev8.css" type="text/css" />
<%
int imageFileId = -1;
String aboutdoc = Util.null2String(request.getParameter("aboutdoc"),"-1");
String sql = "select count(aboutdoc) from CE_NonstandardFunction where aboutdoc = " + aboutdoc;
RecordSet.executeSql(sql);
boolean flag = false;
boolean isPDF = false;
boolean canView = false;
if(RecordSet.next()){
flag = true;
}
String canDownload="false";
String canPrint="false";
String imagefilename = "";
if(true)
{
sql = "select imagefilename,imagefileid from DocImageFile where docid = " + aboutdoc;
RecordSet.executeSql(sql);
if(RecordSet.next()){
imageFileId = RecordSet.getInt("imagefileid");
isPDF = Util.null2String(RecordSet.getString("imagefilename"),"").endsWith(".pdf");
imagefilename = Util.null2String(RecordSet.getString("imagefilename"),"document.pdf");
if(imagefilename.endsWith(".ppt") ||
imagefilename.endsWith(".pptx") ||
imagefilename.endsWith(".doc") ||
imagefilename.endsWith(".docx") ||
imagefilename.endsWith(".xls") ||
imagefilename.endsWith(".xlsx") ||
imagefilename.endsWith(".wps"))
{
canView = true;
}
}
try{
if(canView)
{
int htmlFileId = 0;
if("true".equals(isPDF))
{
htmlFileId = imageFileId;
}
else
{
sql = "select * from pdf_imagefile where imagefileid="+imageFileId;
RecordSet.executeSql(sql);
if(RecordSet.next()){
htmlFileId = Util.getIntValue(RecordSet.getString("pdfimagefileid"),0);
}
else
{
ConvertPDFTools convertPDFTools = new ConvertPDFTools();
htmlFileId= convertPDFTools.conertToPdf(imageFileId+"");
}
}
if(htmlFileId>0){
%>
<script type="text/javascript">
try{
document.body.style.overflow="hidden";
}catch(e){}
function hideLoading(){
try{
parent.finalDo("view");
}catch(e){
window.setTimeout(function(){
try{
parent.finalDo("view");
}catch(e){}
},1000);
}
}
</script>
<iframe id="htmlShowContent" frameborder="0"
style="width: 100%; height: 100%;"
src="<%="/docs/pdfview/web/pdfViewer.jsp?imagefilename="+imagefilename+"&canPrint=false&canDownload=false&aboutdoc="+aboutdoc+"&pdfimagefileid="+htmlFileId %>"
onload="hideLoading();"></iframe>
<% } } else {
response.sendRedirect("/weaver/weaver.homepage.HomepageCreateImage?aboutdoc="+aboutdoc+"&fileid=" + imageFileId) ;
}
}catch(Exception e){
RecordSet.writeLog(e);
request.setAttribute("labelid","123456");
request.getRequestDispatcher("/wui/common/page/sysRemind.jsp").forward(request,response);
return;
}
}
else
{ %>
<%--500659 您查看的不是非标文档--%>
<%=SystemEnv.getHtmlLabelName(500659, user.getLanguage())%>
<%
}
%>