diff --git a/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/certPopList.jsp b/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/certPopList.jsp index 33456b62..0e242ae1 100644 --- a/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/certPopList.jsp +++ b/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/certPopList.jsp @@ -25,8 +25,6 @@ - - @@ -388,8 +386,24 @@ async function makePDF() { // 1️⃣ body에 임시 클론을 붙여서 화면 밖에서도 렌더링되도록 함 const cloned = element.cloneNode(true); const container = document.createElement('div'); - - container.style.position = 'fixed'; + + // pdf style 적용이 안되서 추가 + const styleEl = document.createElement('style'); + styleEl.innerHTML = ` + .estimate{padding:30px 3%;} + .estimate *{font-family: 'HYgsrB', sans-serif !important; color:#222 !important;} + .est_body{position:relative; padding:50px 0; text-align:left;} + .est_body h2{font-size:4.4rem; -webkit-text-stroke-width:0.05px; -webkit-text-stroke-color:#222; text-align:center;} + .est_body .cont1>div p{width:100%;margin:0 0 0 30px;text-align:left;line-height: 1.5;} + .est_body .cont5 div{display:block;} + .est_body .cont5 div span:first-child{font-size:1.8rem; font-weight:700; line-height: 1.5; color:#222; margin:0 0 10px 30px; display:block;text-align:left;} + .est_body .cont5.substance>div{margin:100px 0; text-align:center;} + .est_body .cont5.substance>div p{font-size:2rem; font-weight:700; color:#222; margin:0 50px; line-height:1.5; text-align:justify; letter-spacing:1px;} + .est_body .cont5 .date{font-size:1.8rem; font-weight:700; color:#222; display:block; text-align:center; margin-bottom:10px;} + .est_body .cont5 .date+div span{font-size: 3.2rem;text-align:center;}`; + cloned.prepend(styleEl); + + container.style.position = 'absolute'; container.style.top = '0'; container.style.left = '0'; container.style.width = element.scrollWidth + 'px'; @@ -397,8 +411,12 @@ async function makePDF() { container.style.background = 'white'; container.style.zIndex = '-1'; container.style.overflow = 'visible'; + container.style.fontFamily = "'HYgsrB', sans-serif"; + container.style.fontWeight = '700'; + container.style.opacity = '0'; container.appendChild(cloned); document.body.appendChild(container); + // 2️⃣ 클론 기준으로 html2canvas 렌더링 const canvas = await html2canvas(cloned, { @@ -408,7 +426,7 @@ async function makePDF() { scrollY: 0, windowWidth: cloned.scrollWidth, windowHeight: cloned.scrollHeight, - backgroundColor: "#FFFFFF", + backgroundColor: "#ffffff", }); // 3️⃣ 임시 클론 제거 @@ -416,35 +434,57 @@ async function makePDF() { // 4️⃣ PDF 생성 const imgData = canvas.toDataURL("image/png"); + const watermarkImg = await loadImage('/ipedu/visitEdu/usr/publish/images/content/watermark.png'); // 추가 + + const pdf = new jsPDF("p", "mm", "a4"); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); + const imgProps = pdf.getImageProperties(imgData); + const imgWidth = pdfWidth; + const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; + //alert(pdfWidth); //alert(pdfHeight); - - const imgWidth = pdfWidth; - const imgHeight = (canvas.height * pdfWidth) / canvas.width; //const imgHeight = pdfHeight; - //alert(imgWidth); //alert(imgHeight); - + let heightLeft = imgHeight; let position = 0; + const yOffset = (pdfHeight - imgHeight) / 2; - pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight); - heightLeft -= pdfHeight; - + /* + pdf.addImage(imgData, "PNG", 0, yOffset, imgWidth, imgHeight); + heightLeft -= pdfHeight; + */ + while (heightLeft > 0) { - position = heightLeft - imgHeight; - pdf.addPage(); - pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight); - heightLeft -= pdfHeight; - } + + position = heightLeft - imgHeight; + + pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight); + pdf.addImage(watermarkImg, 'PNG', pdfWidth / 2 - 40, pdfHeight / 2 - 40, 80, 80); + heightLeft -= pdfHeight; + + if (heightLeft > 0) pdf.addPage(); + } + pdf.save("divBody_전체.pdf"); - } + } + + // 워터마크 이미지 로드 함수 +function loadImage(src) { + return new Promise((resolve, reject) => { + const img = new Image(); + img.crossOrigin = "anonymous"; + img.onload = () => resolve(img); + img.onerror = reject; + img.src = src; + }); +}
@@ -465,84 +505,78 @@ async function makePDF() { -
diff --git a/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/qustnrFndtnPopList.jsp b/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/qustnrFndtnPopList.jsp index 928f17fd..66c760ae 100644 --- a/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/qustnrFndtnPopList.jsp +++ b/src/main/webapp/WEB-INF/jsp/web/ve/aplct/cpyrgExprnClsrm/exprnClsrmInfo/popup/qustnrFndtnPopList.jsp @@ -307,7 +307,7 @@ $(document).ready(function(){ -