Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
d74c0e7b
Commit
d74c0e7b
authored
May 01, 2019
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新pdf预览
parent
342a1adb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
src/main/java/cn/stylefeng/guns/modular/demos/controller/PdfPreviewController.java
+3
-7
No files found.
src/main/java/cn/stylefeng/guns/modular/demos/controller/PdfPreviewController.java
View file @
d74c0e7b
...
...
@@ -19,15 +19,12 @@ import cn.stylefeng.roses.core.base.controller.BaseController;
import
cn.stylefeng.roses.core.util.ToolUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.io.IOException
;
/**
* pdf预览
*
...
...
@@ -53,16 +50,15 @@ public class PdfPreviewController extends BaseController {
*/
@GetMapping
(
value
=
"/loadPdfFile"
,
produces
=
"application/pdf"
)
@ResponseBody
public
FileSystem
Resource
loadPdfFile
(
@RequestParam
(
value
=
"file"
,
required
=
false
)
String
file
)
{
public
ClassPath
Resource
loadPdfFile
(
@RequestParam
(
value
=
"file"
,
required
=
false
)
String
file
)
{
if
(
ToolUtil
.
isEmpty
(
file
))
{
file
=
"demo.pdf"
;
}
try
{
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"assets/expand/pdf/demo/"
+
file
);
return
new
FileSystemResource
(
classPathResource
.
getFile
().
getAbsolutePath
());
}
catch
(
IOException
e
)
{
return
new
ClassPathResource
(
"assets/expand/pdf/demo/"
+
file
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
...
...
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