pdf출력시 새창에서 미리보기 화면이 표시되도록 수정

main
이범준 10 months ago
parent 8f7b53a6c9
commit 3f903d859d

@ -143,12 +143,13 @@ $(document).ready(function(){
data : submitParam, data : submitParam,
success : (resp) => { success : (resp) => {
if(resp.filePath != null && resp.filePath != ""){ if(resp.filePath != null && resp.filePath != ""){
var a = document.createElement("a");
a.href = resp.filePath; if(fileType == "pdf"){
a.download = resp.fileName; openPDF(resp.filePath, resp.fileName, resp.fileName);
document.getElementById("tempArea--${pageName}").appendChild(a); } else {
a.click(); downloadFile(resp.filePath, resp.fileName, "tempArea--${pageName}");
document.getElementById("tempArea--${pageName}").removeChild(a); }
} }
} }
}); });

@ -141,12 +141,13 @@ $(document).ready(function(){
data : submitParam, data : submitParam,
success : (resp) => { success : (resp) => {
if(resp.filePath != null && resp.filePath != ""){ if(resp.filePath != null && resp.filePath != ""){
var a = document.createElement("a");
a.href = resp.filePath; if(fileType == "pdf"){
a.download = resp.fileName; openPDF(resp.filePath, resp.fileName, resp.fileName);
document.getElementById("tempArea--${pageName}").appendChild(a); } else {
a.click(); downloadFile(resp.filePath, resp.fileName, "tempArea--${pageName}");
document.getElementById("tempArea--${pageName}").removeChild(a); }
} }
} }
}); });

@ -764,15 +764,7 @@ $(document).ready(function(){
data : submitParam, data : submitParam,
success : (resp) => { success : (resp) => {
if(resp.filePath != null && resp.filePath != ""){ if(resp.filePath != null && resp.filePath != ""){
openPDF(resp.filePath, resp.fileName, "pdf_sample");
var samplePath = resp.filePath;
samplePath = samplePath.replaceAll("\\","%5c");
window.open(
wctx.url("/resources/html/pdf.html"+"?"+"path="+samplePath)
,"pdf_sample"
,'top=10, left=10'
);
} }
} }
}); });

@ -1,3 +1,22 @@
function download(filePath, fileName, tempAreaId){
var a = document.createElement("a");
a.href = resp.filePath;
a.download = resp.fileName;
document.getElementById(tempAreaId).appendChild(a);
a.click();
document.getElementById(tempAreaId).removeChild(a);
}
function openPDF(filePath, fileName, windowName){
filePath = filePath.replaceAll("\\","%5c");
window.open(
wctx.url("/resources/html/pdf.html"+"?"+"path="+filePath)
,windowName
,'top=10, left=10'
);
}
//엑셀 파일 생성 정보 //엑셀 파일 생성 정보
function getCellDefs($th, $td){ function getCellDefs($th, $td){
var cellDefs = []; var cellDefs = [];

Loading…
Cancel
Save