pdf 뷰어 커밋
This commit is contained in:
parent
9d10971246
commit
611c723f87
@ -143,7 +143,7 @@ public final class PdfUtil {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf";
|
return uuid + ".pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -452,4 +452,75 @@ public class EgovFileDownloadController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다.
|
||||||
|
*
|
||||||
|
* @param commandMap
|
||||||
|
* @param response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/cmm/fms/FileDowntest.do")
|
||||||
|
public void FileDowntest(@RequestParam Map<String, Object> commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
String fileNm = (String) commandMap.get("fileNm");
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
|
||||||
|
long fSize = uFile.length();
|
||||||
|
|
||||||
|
if (fSize > 0) {
|
||||||
|
String mimetype = "application/x-msdownload";
|
||||||
|
|
||||||
|
response.setContentType(mimetype);
|
||||||
|
setDisposition(fileNm, request, response);
|
||||||
|
//response.setContentLength(fSize);
|
||||||
|
|
||||||
|
BufferedInputStream in = null;
|
||||||
|
BufferedOutputStream out = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
in = new BufferedInputStream(new FileInputStream(uFile));
|
||||||
|
out = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
|
||||||
|
FileCopyUtils.copy(in, out);
|
||||||
|
out.flush();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOGGER.debug("IGNORED: {}", ex.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (in != null) {
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (out != null) {
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
response.setContentType("application/x-msdownload");
|
||||||
|
|
||||||
|
PrintWriter printwriter = response.getWriter();
|
||||||
|
printwriter.println("<html>");
|
||||||
|
printwriter.println("<br><br><br><h2>Could not get file name:<br>" + fileNm + "</h2>");
|
||||||
|
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
|
||||||
|
printwriter.println("<br><br><br>© webAccess");
|
||||||
|
printwriter.println("</html>");
|
||||||
|
printwriter.flush();
|
||||||
|
printwriter.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
var ctx = canvas.getContext('2d');
|
var ctx = canvas.getContext('2d');
|
||||||
/* var url = '/cmm/fms/FileDown.do?atchFileId=FILE_000000000019061&fileSn=0'; */
|
/* var url = '/cmm/fms/FileDown.do?atchFileId=FILE_000000000019061&fileSn=0'; */
|
||||||
// var url = '/usr/local/tomcat/file/sht/pdf/2ccbb16e-62df-48c0-bbb1-3b6559bd4c36.pdf';
|
// var url = '/usr/local/tomcat/file/sht/pdf/2ccbb16e-62df-48c0-bbb1-3b6559bd4c36.pdf';
|
||||||
var url = '<c:url value="${pdfPath}"/>';
|
var url = '/cmm/fms/FileDowntest.do?fileNm=${pdfPath}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get page info from document, resize canvas accordingly, and render page.
|
* Get page info from document, resize canvas accordingly, and render page.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user