Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
slm-fileview
Commits
a49ee9d7
Commit
a49ee9d7
authored
Apr 26, 2019
by
陈精华
Committed by
kl
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片预览可在viewjs中大图预览&翻页
parent
ae40d023
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
OfficeFilePreviewImpl.java
...in/java/cn/keking/service/impl/OfficeFilePreviewImpl.java
+7
-2
officePicture.ftl
jodconverter-web/src/main/resources/web/officePicture.ftl
+5
-5
pdf.ftl
jodconverter-web/src/main/resources/web/pdf.ftl
+1
-1
No files found.
jodconverter-web/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java
View file @
a49ee9d7
...
@@ -41,6 +41,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
...
@@ -41,6 +41,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
public
static
final
String
OFFICE_PREVIEW_TYPE_PDF
=
"pdf"
;
public
static
final
String
OFFICE_PREVIEW_TYPE_PDF
=
"pdf"
;
public
static
final
String
OFFICE_PREVIEW_TYPE_IMAGE
=
"image"
;
public
static
final
String
OFFICE_PREVIEW_TYPE_IMAGE
=
"image"
;
public
static
final
String
OFFICE_PREVIEW_TYPE_ALLIMAGES
=
"allImages"
;
@Override
@Override
public
String
filePreviewHandle
(
String
url
,
Model
model
)
{
public
String
filePreviewHandle
(
String
url
,
Model
model
)
{
...
@@ -78,7 +79,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
...
@@ -78,7 +79,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
fileUtils
.
addConvertedFile
(
pdfName
,
fileUtils
.
getRelativePath
(
outFilePath
));
fileUtils
.
addConvertedFile
(
pdfName
,
fileUtils
.
getRelativePath
(
outFilePath
));
}
}
}
}
if
(
OFFICE_PREVIEW_TYPE_IMAGE
.
equals
(
officePreviewType
))
{
if
(
OFFICE_PREVIEW_TYPE_IMAGE
.
equals
(
officePreviewType
)
||
OFFICE_PREVIEW_TYPE_ALLIMAGES
.
equals
(
officePreviewType
)
)
{
List
<
String
>
imageUrls
=
pdfUtils
.
pdf2jpg
(
outFilePath
,
pdfName
,
url
);
List
<
String
>
imageUrls
=
pdfUtils
.
pdf2jpg
(
outFilePath
,
pdfName
,
url
);
if
(
imageUrls
==
null
||
imageUrls
.
size
()
<
1
)
{
if
(
imageUrls
==
null
||
imageUrls
.
size
()
<
1
)
{
model
.
addAttribute
(
"msg"
,
"office转图片异常,请联系管理员"
);
model
.
addAttribute
(
"msg"
,
"office转图片异常,请联系管理员"
);
...
@@ -87,7 +88,11 @@ public class OfficeFilePreviewImpl implements FilePreview {
...
@@ -87,7 +88,11 @@ public class OfficeFilePreviewImpl implements FilePreview {
}
}
model
.
addAttribute
(
"imgurls"
,
imageUrls
);
model
.
addAttribute
(
"imgurls"
,
imageUrls
);
model
.
addAttribute
(
"currentUrl"
,
imageUrls
.
get
(
0
));
model
.
addAttribute
(
"currentUrl"
,
imageUrls
.
get
(
0
));
return
"officePicture"
;
if
(
OFFICE_PREVIEW_TYPE_IMAGE
.
equals
(
officePreviewType
))
{
return
"officePicture"
;
}
else
{
return
"picture"
;
}
}
}
model
.
addAttribute
(
"pdfUrl"
,
pdfName
);
model
.
addAttribute
(
"pdfUrl"
,
pdfName
);
return
isHtml
?
"html"
:
"pdf"
;
return
isHtml
?
"html"
:
"pdf"
;
...
...
jodconverter-web/src/main/resources/web/officePicture.ftl
View file @
a49ee9d7
...
@@ -18,20 +18,20 @@
...
@@ -18,20 +18,20 @@
<div
class=
"container"
>
<div
class=
"container"
>
<
#
list
imgurls
as
img
>
<
#
list
imgurls
as
img
>
<div
class=
"img-area"
>
<div
class=
"img-area"
>
<img
class=
"my-photo"
alt=
"loading"
data-src=
"${img}"
src=
"images/loading.gif
"
>
<img
class=
"my-photo"
alt=
"loading"
title=
"查看大图"
style=
"cursor: pointer;"
data-src=
"${img}"
src=
"images/loading.gif"
onclick=
"changePreviewType('allImages')
"
>
</div>
</div>
</
#
list>
</
#
list>
</div>
</div>
<img
src=
"images/
left.png"
style=
"position: fixed; cursor: pointer; top: 40%; left: 50px; z-index: 999;"
alt=
"PDF预览"
onclick=
"goForPdf(
)"
/>
<img
src=
"images/
right.png"
style=
"position: fixed; cursor: pointer; top: 40%; right: 70px; z-index: 999;"
alt=
"使用PDF预览"
title=
"使用PDF预览"
onclick=
"changePreviewType('pdf'
)"
/>
<script>
<script>
window
.
onload
=
checkImgs
;
window
.
onload
=
checkImgs
;
window
.
onscroll
=
throttle
(
checkImgs
);
window
.
onscroll
=
throttle
(
checkImgs
);
function
goForPdf
(
)
{
function
changePreviewType
(
previewType
)
{
var
url
=
window
.
location
.
href
;
var
url
=
window
.
location
.
href
;
if
(
url
.
indexOf
(
"officePreviewType=image"
)
!=
-
1
)
{
if
(
url
.
indexOf
(
"officePreviewType=image"
)
!=
-
1
)
{
url
=
url
.
replace
(
"officePreviewType=image"
,
"officePreviewType=
pdf"
);
url
=
url
.
replace
(
"officePreviewType=image"
,
"officePreviewType=
"
+
previewType
);
}
else
{
}
else
{
url
=
url
+
"&officePreviewType=
pdf"
;
url
=
url
+
"&officePreviewType=
"
+
previewType
;
}
}
window
.
location
.
href
=
url
;
window
.
location
.
href
=
url
;
}
}
...
...
jodconverter-web/src/main/resources/web/pdf.ftl
View file @
a49ee9d7
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</
#
if>
</
#
if>
<iframe
src=
"/pdfjs/web/viewer.html?file=${finalUrl}"
width=
"100%"
frameborder=
"0"
></iframe>
<iframe
src=
"/pdfjs/web/viewer.html?file=${finalUrl}"
width=
"100%"
frameborder=
"0"
></iframe>
<img
src=
"images/
right.png"
style=
"position: fixed; cursor: pointer; top: 40%; right: 50px; z-index: 999;"
alt=
"
图片预览"
onclick=
"goForImage()"
/>
<img
src=
"images/
left.png"
style=
"position: fixed; cursor: pointer; top: 40%; right: 70px; z-index: 999;"
alt=
"使用图片预览"
title=
"使用
图片预览"
onclick=
"goForImage()"
/>
</body>
</body>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment