기업회원 첨부파일 PDF뷰어 기능추가
This commit is contained in:
parent
c2dcb50663
commit
edb70d1d90
@ -110,7 +110,7 @@ public final class PdfUtil {
|
|||||||
File imgFiles = new File(imgDir + "." +extsn);
|
File imgFiles = new File(imgDir + "." +extsn);
|
||||||
Image img = ImageIO.read(imgFiles);
|
Image img = ImageIO.read(imgFiles);
|
||||||
|
|
||||||
PDPage page = new PDPage(PDRectangle.A2);
|
PDPage page = new PDPage(PDRectangle.A4);
|
||||||
doc.addPage(page);
|
doc.addPage(page);
|
||||||
|
|
||||||
PDImageXObject pdImage = PDImageXObject.createFromFile(imgFiles.toString(), doc);
|
PDImageXObject pdImage = PDImageXObject.createFromFile(imgFiles.toString(), doc);
|
||||||
@ -131,8 +131,8 @@ public final class PdfUtil {
|
|||||||
PDPageContentStream contents = new PDPageContentStream(doc, page);
|
PDPageContentStream contents = new PDPageContentStream(doc, page);
|
||||||
contents.drawImage(pdImage, pageWidthPosition, pageHeightPosition, imgWidth, imgHeight);
|
contents.drawImage(pdImage, pageWidthPosition, pageHeightPosition, imgWidth, imgHeight);
|
||||||
contents.close();
|
contents.close();
|
||||||
doc.save("/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf");
|
//doc.save("/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf");
|
||||||
//doc.save("C:/TEST/" + uuid + ".pdf");
|
doc.save("C:/TEST/" + uuid + ".pdf");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Exception! : " + e.getMessage());
|
System.out.println("Exception! : " + e.getMessage());
|
||||||
|
|||||||
@ -466,8 +466,8 @@ public class EgovFileDownloadController {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
|
//File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
|
||||||
//File uFile = new File("C:/TEST/", fileNm);
|
File uFile = new File("C:/TEST/", fileNm);
|
||||||
|
|
||||||
long fSize = uFile.length();
|
long fSize = uFile.length();
|
||||||
|
|
||||||
|
|||||||
@ -5049,13 +5049,22 @@ public class MjonMsgController {
|
|||||||
|
|
||||||
FileVO fvo = fileService.selectFileInf(fileVO);
|
FileVO fvo = fileService.selectFileInf(fileVO);
|
||||||
String path = "";
|
String path = "";
|
||||||
|
String fileType = "";
|
||||||
|
String[] imgExtArray = {"bmp", "gif", "jpeg", "jpg", "png", "tif", "tiff", "psd", "rle"};
|
||||||
|
List<String> imgExtList = new ArrayList<>(Arrays.asList(imgExtArray));
|
||||||
|
|
||||||
if(fvo != null) {
|
if(fvo != null) {
|
||||||
if("pdf".equals(fvo.getFileExtsn())) {
|
if("pdf".equals(fvo.getFileExtsn())) {
|
||||||
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
|
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
|
||||||
|
fileType = "pdf";
|
||||||
|
} else if(imgExtList.contains(fvo.getFileExtsn())) {
|
||||||
|
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
|
||||||
|
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
|
||||||
|
fileType = "img";
|
||||||
} else {
|
} else {
|
||||||
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
|
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
|
||||||
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
|
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
|
||||||
|
fileType = "etc";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5066,6 +5075,8 @@ public class MjonMsgController {
|
|||||||
String hstMbtlNum = request.getParameter("hstMbtlNum");
|
String hstMbtlNum = request.getParameter("hstMbtlNum");
|
||||||
|
|
||||||
model.addAttribute("pdfPath", path);
|
model.addAttribute("pdfPath", path);
|
||||||
|
model.addAttribute("fileType", fileType);
|
||||||
|
model.addAttribute("atchFileId", fileVO.getAtchFileId());
|
||||||
model.addAttribute("mberNm", mberNm);
|
model.addAttribute("mberNm", mberNm);
|
||||||
model.addAttribute("bizNo", bizNo);
|
model.addAttribute("bizNo", bizNo);
|
||||||
model.addAttribute("ceoNm", ceoNm);
|
model.addAttribute("ceoNm", ceoNm);
|
||||||
@ -5080,17 +5091,27 @@ public class MjonMsgController {
|
|||||||
|
|
||||||
FileVO fvo = fileService.selectFileInf(fileVO);
|
FileVO fvo = fileService.selectFileInf(fileVO);
|
||||||
String path = "";
|
String path = "";
|
||||||
|
String fileType = "";
|
||||||
|
String[] imgExtArray = {"bmp", "gif", "jpeg", "jpg", "png", "tif", "tiff", "psd", "rle"};
|
||||||
|
List<String> imgExtList = new ArrayList<>(Arrays.asList(imgExtArray));
|
||||||
|
|
||||||
if(fvo != null) {
|
if(fvo != null) {
|
||||||
if("pdf".equals(fvo.getFileExtsn())) {
|
if("pdf".equals(fvo.getFileExtsn())) {
|
||||||
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
|
path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
|
||||||
|
fileType = "pdf";
|
||||||
|
} else if(imgExtList.contains(fvo.getFileExtsn())) {
|
||||||
|
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
|
||||||
|
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
|
||||||
|
fileType = "img";
|
||||||
} else {
|
} else {
|
||||||
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
|
String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
|
||||||
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
|
path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
|
||||||
|
fileType = "etc";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("pdfPath", path);
|
model.addAttribute("pdfPath", path);
|
||||||
|
model.addAttribute("fileType", fileType);
|
||||||
|
|
||||||
return "/uss/ion/msg/pdfView";
|
return "/uss/ion/msg/pdfView";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<c:forEach var="fileVO" items="${fileList}" varStatus="status">
|
<c:forEach var="fileVO" items="${fileList}" varStatus="status">
|
||||||
<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>
|
<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>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|
||||||
<iframe width=0 height=0 name='hiddenframe' style='display:none;'></iframe>
|
<iframe width=0 height=0 name='hiddenframe' style='display:none;'></iframe>
|
||||||
|
|||||||
@ -30,9 +30,9 @@ function pdfViewPop(atchFileId,mberNm,bizNo,ceoNm,hstManagerNm,hstMbtlNum) {
|
|||||||
document.pdfForm.hstManagerNm.value = hstManagerNm;
|
document.pdfForm.hstManagerNm.value = hstManagerNm;
|
||||||
document.pdfForm.hstMbtlNum.value = hstMbtlNum;
|
document.pdfForm.hstMbtlNum.value = hstMbtlNum;
|
||||||
document.pdfForm.fileSn.value = 0;
|
document.pdfForm.fileSn.value = 0;
|
||||||
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');
|
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');
|
||||||
document.pdfForm.action = "<c:url value='/uss/ion/msg/pdfView.do'/>";
|
document.pdfForm.action = "<c:url value='/uss/ion/msg/pdfView.do'/>";
|
||||||
document.pdfForm.target = "taxListPopup";
|
document.pdfForm.target = "pdfPopup";
|
||||||
document.pdfForm.submit();
|
document.pdfForm.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ function fnSetCalMonth(val) {
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<form name="pdfForm" action="<c:url value='/uss/ion/msg/pdfView.do'/>" method="post">
|
<form name="pdfForm" method="post">
|
||||||
<input type="hidden" name="atchFileId"/>
|
<input type="hidden" name="atchFileId"/>
|
||||||
<input type="hidden" name="fileSn"/>
|
<input type="hidden" name="fileSn"/>
|
||||||
<input type="hidden" name="mberNm"/>
|
<input type="hidden" name="mberNm"/>
|
||||||
@ -478,29 +478,29 @@ function fnSetCalMonth(val) {
|
|||||||
<td><c:out value="${result.hstMbtlNum}"/></td>
|
<td><c:out value="${result.hstMbtlNum}"/></td>
|
||||||
<td class="td_file" style="vertical-align:middle;">
|
<td class="td_file" style="vertical-align:middle;">
|
||||||
<c:if test="${result.atchFileId ne '' || result.atchFileId ne null}">
|
<c:if test="${result.atchFileId ne '' || result.atchFileId ne null}">
|
||||||
<c:import url="/cmm/fms/selectAddrAgencyFileInfs.do" charEncoding="utf-8">
|
<c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8">
|
||||||
<c:param name="param_atchFileId" value="${result.atchFileId}" />
|
<c:param name="param_atchFileId" value="${result.atchFileId}" />
|
||||||
</c:import>
|
</c:import>
|
||||||
</c:if>
|
</c:if>
|
||||||
<%--
|
|
||||||
|
<!--/cmm/fms/selectAddrAgencyFileInfs.do-->
|
||||||
<!--/cmm/fms/selectMberFileInfs.do-->
|
<!--/cmm/fms/selectMberFileInfs.do-->
|
||||||
<c:if test="${result.atchFileId ne '' && result.atchFileId ne null}">
|
<c:if test="${result.atchFileId ne '' && result.atchFileId ne null}">
|
||||||
<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>
|
<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>
|
||||||
</c:if>
|
</c:if>
|
||||||
--%>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="td_file">
|
<td class="td_file">
|
||||||
<c:if test="${result.workAtchFileId ne '' || result.workAtchFileId ne null}">
|
<c:if test="${result.workAtchFileId ne '' || result.workAtchFileId ne null}">
|
||||||
<c:import url="/cmm/fms/selectAddrAgencyFileInfs.do" charEncoding="utf-8">
|
<c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8">
|
||||||
<c:param name="param_atchFileId" value="${result.workAtchFileId}" />
|
<c:param name="param_atchFileId" value="${result.workAtchFileId}" />
|
||||||
</c:import>
|
</c:import>
|
||||||
</c:if>
|
</c:if>
|
||||||
<%--
|
|
||||||
<!--/cmm/fms/selectMberFileInfs.do-->
|
|
||||||
<c:if test="${result.workAtchFileId ne '' && result.workAtchFileId ne null}">
|
<c:if test="${result.workAtchFileId ne '' && result.workAtchFileId ne null}">
|
||||||
<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>
|
<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>
|
||||||
</c:if>
|
</c:if>
|
||||||
--%>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<c:forEach var="item" items="${hstTypeList}" varStatus="status">
|
<c:forEach var="item" items="${hstTypeList}" varStatus="status">
|
||||||
|
|||||||
@ -31,8 +31,16 @@
|
|||||||
<link rel="stylesheet" href="/pb/css/content.css?date=202301160001">
|
<link rel="stylesheet" href="/pb/css/content.css?date=202301160001">
|
||||||
<link rel="stylesheet" href="/pb/css/popup.css">
|
<link rel="stylesheet" href="/pb/css/popup.css">
|
||||||
|
|
||||||
|
<script src="/pb/js/jquery-3.5.0.js"></script>
|
||||||
<script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script>
|
<script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script>
|
||||||
<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
|
<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -67,7 +75,15 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<canvas id="the-canvas" name="the-canvas" style="max-width: 1000px; margin-top: 25px; margin-bottom: 25px;"></canvas>
|
<c:if test="${fileType eq 'etc'}">
|
||||||
|
<div style="width: 100%; text-align: center; margin: 30px 0 30px 0; color: red;">
|
||||||
|
PDF 뷰어에서 지원하지 않는 형식의 파일입니다. 첨부파일 다운로드후 확인해주세요.
|
||||||
|
<c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8">
|
||||||
|
<c:param name="param_atchFileId" value="${atchFileId}" />
|
||||||
|
</c:import>
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
<canvas id="the-canvas" name="the-canvas" style="min-width: 700px; max-width: 1000px; margin-top: 25px; margin-bottom: 25px;"></canvas>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="btnType" id="prev">Previous</button>
|
<button class="btnType" id="prev">Previous</button>
|
||||||
@ -86,7 +102,7 @@
|
|||||||
var pageNum = 1;
|
var pageNum = 1;
|
||||||
var pageRendering = false;
|
var pageRendering = false;
|
||||||
var pageNumPending = null;
|
var pageNumPending = null;
|
||||||
var scale = 0.8;
|
var scale = 1.4;
|
||||||
var canvas = document.getElementById('the-canvas');
|
var canvas = document.getElementById('the-canvas');
|
||||||
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'; */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user