기업회원 첨부파일 PDF뷰어 기능추가
@edb70d1d900e48c121a50fd146f022721b28a9e0
--- src/main/java/itn/com/cmm/util/PdfUtil.java
+++ src/main/java/itn/com/cmm/util/PdfUtil.java
... | ... | @@ -110,7 +110,7 @@ |
| 110 | 110 |
File imgFiles = new File(imgDir + "." +extsn); |
| 111 | 111 |
Image img = ImageIO.read(imgFiles); |
| 112 | 112 |
|
| 113 |
- PDPage page = new PDPage(PDRectangle.A2); |
|
| 113 |
+ PDPage page = new PDPage(PDRectangle.A4); |
|
| 114 | 114 |
doc.addPage(page); |
| 115 | 115 |
|
| 116 | 116 |
PDImageXObject pdImage = PDImageXObject.createFromFile(imgFiles.toString(), doc); |
... | ... | @@ -131,8 +131,8 @@ |
| 131 | 131 |
PDPageContentStream contents = new PDPageContentStream(doc, page); |
| 132 | 132 |
contents.drawImage(pdImage, pageWidthPosition, pageHeightPosition, imgWidth, imgHeight); |
| 133 | 133 |
contents.close(); |
| 134 |
- doc.save("/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf");
|
|
| 135 |
- //doc.save("C:/TEST/" + uuid + ".pdf");
|
|
| 134 |
+ //doc.save("/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf");
|
|
| 135 |
+ doc.save("C:/TEST/" + uuid + ".pdf");
|
|
| 136 | 136 |
|
| 137 | 137 |
} catch (Exception e) {
|
| 138 | 138 |
System.out.println("Exception! : " + e.getMessage());
|
--- src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
+++ src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
... | ... | @@ -466,8 +466,8 @@ |
| 466 | 466 |
try {
|
| 467 | 467 |
|
| 468 | 468 |
|
| 469 |
- File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
|
|
| 470 |
- //File uFile = new File("C:/TEST/", fileNm);
|
|
| 469 |
+ //File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
|
|
| 470 |
+ File uFile = new File("C:/TEST/", fileNm);
|
|
| 471 | 471 |
|
| 472 | 472 |
long fSize = uFile.length(); |
| 473 | 473 |
|
--- src/main/java/itn/let/mjo/msg/web/MjonMsgController.java
+++ src/main/java/itn/let/mjo/msg/web/MjonMsgController.java
... | ... | @@ -5049,13 +5049,22 @@ |
| 5049 | 5049 |
|
| 5050 | 5050 |
FileVO fvo = fileService.selectFileInf(fileVO); |
| 5051 | 5051 |
String path = ""; |
| 5052 |
+ String fileType = ""; |
|
| 5053 |
+ String[] imgExtArray = {"bmp", "gif", "jpeg", "jpg", "png", "tif", "tiff", "psd", "rle"};
|
|
| 5054 |
+ List<String> imgExtList = new ArrayList<>(Arrays.asList(imgExtArray)); |
|
| 5052 | 5055 |
|
| 5053 | 5056 |
if(fvo != null) {
|
| 5054 | 5057 |
if("pdf".equals(fvo.getFileExtsn())) {
|
| 5055 | 5058 |
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn(); |
| 5056 |
- }else {
|
|
| 5059 |
+ fileType = "pdf"; |
|
| 5060 |
+ } else if(imgExtList.contains(fvo.getFileExtsn())) {
|
|
| 5057 | 5061 |
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm(); |
| 5058 | 5062 |
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn()); |
| 5063 |
+ fileType = "img"; |
|
| 5064 |
+ } else {
|
|
| 5065 |
+ String storePath = fvo.getFileStreCours() + fvo.getStreFileNm(); |
|
| 5066 |
+ path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn()); |
|
| 5067 |
+ fileType = "etc"; |
|
| 5059 | 5068 |
} |
| 5060 | 5069 |
} |
| 5061 | 5070 |
|
... | ... | @@ -5066,6 +5075,8 @@ |
| 5066 | 5075 |
String hstMbtlNum = request.getParameter("hstMbtlNum");
|
| 5067 | 5076 |
|
| 5068 | 5077 |
model.addAttribute("pdfPath", path);
|
| 5078 |
+ model.addAttribute("fileType", fileType);
|
|
| 5079 |
+ model.addAttribute("atchFileId", fileVO.getAtchFileId());
|
|
| 5069 | 5080 |
model.addAttribute("mberNm", mberNm);
|
| 5070 | 5081 |
model.addAttribute("bizNo", bizNo);
|
| 5071 | 5082 |
model.addAttribute("ceoNm", ceoNm);
|
... | ... | @@ -5080,17 +5091,27 @@ |
| 5080 | 5091 |
|
| 5081 | 5092 |
FileVO fvo = fileService.selectFileInf(fileVO); |
| 5082 | 5093 |
String path = ""; |
| 5094 |
+ String fileType = ""; |
|
| 5095 |
+ String[] imgExtArray = {"bmp", "gif", "jpeg", "jpg", "png", "tif", "tiff", "psd", "rle"};
|
|
| 5096 |
+ List<String> imgExtList = new ArrayList<>(Arrays.asList(imgExtArray)); |
|
| 5083 | 5097 |
|
| 5084 | 5098 |
if(fvo != null) {
|
| 5085 | 5099 |
if("pdf".equals(fvo.getFileExtsn())) {
|
| 5086 | 5100 |
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn(); |
| 5087 |
- }else {
|
|
| 5101 |
+ fileType = "pdf"; |
|
| 5102 |
+ } else if(imgExtList.contains(fvo.getFileExtsn())) {
|
|
| 5088 | 5103 |
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm(); |
| 5089 | 5104 |
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn()); |
| 5105 |
+ fileType = "img"; |
|
| 5106 |
+ } else {
|
|
| 5107 |
+ String storePath = fvo.getFileStreCours() + fvo.getStreFileNm(); |
|
| 5108 |
+ path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn()); |
|
| 5109 |
+ fileType = "etc"; |
|
| 5090 | 5110 |
} |
| 5091 | 5111 |
} |
| 5092 | 5112 |
|
| 5093 | 5113 |
model.addAttribute("pdfPath", path);
|
| 5114 |
+ model.addAttribute("fileType", fileType);
|
|
| 5094 | 5115 |
|
| 5095 | 5116 |
return "/uss/ion/msg/pdfView"; |
| 5096 | 5117 |
} |
--- src/main/webapp/WEB-INF/jsp/cmm/fms/EgovMberFileList.jsp
+++ src/main/webapp/WEB-INF/jsp/cmm/fms/EgovMberFileList.jsp
... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 |
</script> |
| 34 | 34 |
|
| 35 | 35 |
<c:forEach var="fileVO" items="${fileList}" varStatus="status">
|
| 36 |
- <a href="javascript:fn_egov_downFile('<c:out value="${fileVO.atchFileId}"/>','<c:out value="${fileVO.fileSn}"/>')" class="fileName" title="다운로드"><img src="/publish/images/content/file_img2.png" alt="첨부파일"></a>
|
|
| 36 |
+ <a href="javascript:fn_egov_downFile('<c:out value="${fileVO.atchFileId}"/>','<c:out value="${fileVO.fileSn}"/>')" class="fileName" title="다운로드"><img src="/publish/images/content/file_img2.png" alt="첨부파일" style="vertical-align:middle;"></a>
|
|
| 37 | 37 |
</c:forEach> |
| 38 | 38 |
|
| 39 | 39 |
<iframe width=0 height=0 name='hiddenframe' style='display:none;'></iframe> |
--- src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovMberCmpHstListByType.jsp
+++ src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovMberCmpHstListByType.jsp
... | ... | @@ -30,9 +30,9 @@ |
| 30 | 30 |
document.pdfForm.hstManagerNm.value = hstManagerNm; |
| 31 | 31 |
document.pdfForm.hstMbtlNum.value = hstMbtlNum; |
| 32 | 32 |
document.pdfForm.fileSn.value = 0; |
| 33 |
- window.open("about:blank", 'taxListPopup', 'width=1020, height=800, top=100, left=0, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=no, location=no, scrollbars=yes');
|
|
| 33 |
+ window.open("about:blank", 'pdfPopup', 'width=1020, height=800, top=100, left=0, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=no, location=no, scrollbars=no');
|
|
| 34 | 34 |
document.pdfForm.action = "<c:url value='/uss/ion/msg/pdfView.do'/>"; |
| 35 |
- document.pdfForm.target = "taxListPopup"; |
|
| 35 |
+ document.pdfForm.target = "pdfPopup"; |
|
| 36 | 36 |
document.pdfForm.submit(); |
| 37 | 37 |
} |
| 38 | 38 |
|
... | ... | @@ -300,7 +300,7 @@ |
| 300 | 300 |
</head> |
| 301 | 301 |
<body> |
| 302 | 302 |
|
| 303 |
-<form name="pdfForm" action="<c:url value='/uss/ion/msg/pdfView.do'/>" method="post"> |
|
| 303 |
+<form name="pdfForm" method="post"> |
|
| 304 | 304 |
<input type="hidden" name="atchFileId"/> |
| 305 | 305 |
<input type="hidden" name="fileSn"/> |
| 306 | 306 |
<input type="hidden" name="mberNm"/> |
... | ... | @@ -478,29 +478,29 @@ |
| 478 | 478 |
<td><c:out value="${result.hstMbtlNum}"/></td>
|
| 479 | 479 |
<td class="td_file" style="vertical-align:middle;"> |
| 480 | 480 |
<c:if test="${result.atchFileId ne '' || result.atchFileId ne null}">
|
| 481 |
- <c:import url="/cmm/fms/selectAddrAgencyFileInfs.do" charEncoding="utf-8"> |
|
| 481 |
+ <c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8"> |
|
| 482 | 482 |
<c:param name="param_atchFileId" value="${result.atchFileId}" />
|
| 483 | 483 |
</c:import> |
| 484 | 484 |
</c:if> |
| 485 |
- <%-- |
|
| 485 |
+ |
|
| 486 |
+ <!--/cmm/fms/selectAddrAgencyFileInfs.do--> |
|
| 486 | 487 |
<!--/cmm/fms/selectMberFileInfs.do--> |
| 487 | 488 |
<c:if test="${result.atchFileId ne '' && result.atchFileId ne null}">
|
| 488 |
- <button class="btnType btnType20" onclick="pdfViewPop('${result.atchFileId}','${result.mberNm}','${result.bizNo}','${result.ceoNm}','${result.hstManagerNm}','${result.hstMbtlNum}')" style="height:20px !important; padding:0 2px !important;">V</button>
|
|
| 489 |
+ <button class="btnType btnType20" onclick="pdfViewPop('${result.atchFileId}','${result.mberNm}','${result.bizNo}','${result.ceoNm}','${result.hstManagerNm}','${result.hstMbtlNum}'); return false;" style="height:20px !important; padding:0 2px !important;">V</button>
|
|
| 489 | 490 |
</c:if> |
| 490 |
- --%> |
|
| 491 |
+ |
|
| 491 | 492 |
</td> |
| 492 | 493 |
<td class="td_file"> |
| 493 | 494 |
<c:if test="${result.workAtchFileId ne '' || result.workAtchFileId ne null}">
|
| 494 |
- <c:import url="/cmm/fms/selectAddrAgencyFileInfs.do" charEncoding="utf-8"> |
|
| 495 |
+ <c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8"> |
|
| 495 | 496 |
<c:param name="param_atchFileId" value="${result.workAtchFileId}" />
|
| 496 | 497 |
</c:import> |
| 497 | 498 |
</c:if> |
| 498 |
- <%-- |
|
| 499 |
- <!--/cmm/fms/selectMberFileInfs.do--> |
|
| 499 |
+ |
|
| 500 | 500 |
<c:if test="${result.workAtchFileId ne '' && result.workAtchFileId ne null}">
|
| 501 |
- <button class="btnType btnType20" onclick="pdfViewPop('${result.workAtchFileId}','${result.mberNm}','${result.bizNo}','${result.ceoNm}','${result.hstManagerNm}','${result.hstMbtlNum}')" style="height:20px !important; padding:0 2px !important;">V</button>
|
|
| 501 |
+ <button class="btnType btnType20" onclick="pdfViewPop('${result.workAtchFileId}','${result.mberNm}','${result.bizNo}','${result.ceoNm}','${result.hstManagerNm}','${result.hstMbtlNum}'); return false;" style="height:20px !important; padding:0 2px !important;">V</button>
|
|
| 502 | 502 |
</c:if> |
| 503 |
- --%> |
|
| 503 |
+ |
|
| 504 | 504 |
</td> |
| 505 | 505 |
<td> |
| 506 | 506 |
<c:forEach var="item" items="${hstTypeList}" varStatus="status">
|
--- src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
+++ src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
... | ... | @@ -26,13 +26,21 @@ |
| 26 | 26 |
<html lang="ko"> |
| 27 | 27 |
|
| 28 | 28 |
<head> |
| 29 |
- <link rel="stylesheet" href="/pb/css/reset.css"> |
|
| 30 |
- <link rel="stylesheet" href="/pb/css/common.css"> |
|
| 31 |
- <link rel="stylesheet" href="/pb/css/content.css?date=202301160001"> |
|
| 32 |
- <link rel="stylesheet" href="/pb/css/popup.css"> |
|
| 29 |
+<link rel="stylesheet" href="/pb/css/reset.css"> |
|
| 30 |
+<link rel="stylesheet" href="/pb/css/common.css"> |
|
| 31 |
+<link rel="stylesheet" href="/pb/css/content.css?date=202301160001"> |
|
| 32 |
+<link rel="stylesheet" href="/pb/css/popup.css"> |
|
| 33 | 33 |
|
| 34 |
- <script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script> |
|
| 35 |
- <script src="//mozilla.github.io/pdf.js/build/pdf.js"></script> |
|
| 34 |
+<script src="/pb/js/jquery-3.5.0.js"></script> |
|
| 35 |
+<script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script> |
|
| 36 |
+<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script> |
|
| 37 |
+ |
|
| 38 |
+<style> |
|
| 39 |
+html {
|
|
| 40 |
+ overflow-x: hidden; |
|
| 41 |
+ overflow-y: auto; |
|
| 42 |
+} |
|
| 43 |
+</style> |
|
| 36 | 44 |
</head> |
| 37 | 45 |
<body> |
| 38 | 46 |
|
... | ... | @@ -67,7 +75,15 @@ |
| 67 | 75 |
</table> |
| 68 | 76 |
</div> |
| 69 | 77 |
|
| 70 |
- <canvas id="the-canvas" name="the-canvas" style="max-width: 1000px; margin-top: 25px; margin-bottom: 25px;"></canvas> |
|
| 78 |
+ <c:if test="${fileType eq 'etc'}">
|
|
| 79 |
+ <div style="width: 100%; text-align: center; margin: 30px 0 30px 0; color: red;"> |
|
| 80 |
+ PDF 뷰어에서 지원하지 않는 형식의 파일입니다. 첨부파일 다운로드후 확인해주세요. |
|
| 81 |
+ <c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8"> |
|
| 82 |
+ <c:param name="param_atchFileId" value="${atchFileId}" />
|
|
| 83 |
+ </c:import> |
|
| 84 |
+ </div> |
|
| 85 |
+ </c:if> |
|
| 86 |
+ <canvas id="the-canvas" name="the-canvas" style="min-width: 700px; max-width: 1000px; margin-top: 25px; margin-bottom: 25px;"></canvas> |
|
| 71 | 87 |
|
| 72 | 88 |
<div> |
| 73 | 89 |
<button class="btnType" id="prev">Previous</button> |
... | ... | @@ -86,7 +102,7 @@ |
| 86 | 102 |
var pageNum = 1; |
| 87 | 103 |
var pageRendering = false; |
| 88 | 104 |
var pageNumPending = null; |
| 89 |
- var scale = 0.8; |
|
| 105 |
+ var scale = 1.4; |
|
| 90 | 106 |
var canvas = document.getElementById('the-canvas');
|
| 91 | 107 |
var ctx = canvas.getContext('2d');
|
| 92 | 108 |
/* var url = '/cmm/fms/FileDown.do?atchFileId=FILE_000000000019061&fileSn=0'; */ |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?