출력물 설정에 따른 접는선 출력 기능 추가

main
이범준 11 months ago
parent cd60437a6b
commit 8758738b85

@ -8,6 +8,7 @@ import java.util.Map;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
@ -128,24 +129,42 @@ public class PDFPrintUtil extends PrintUtil {
}
}
public void renderFoldLine(PDPageContentStream contentStream, float paperWidth, float paperHeight) {
float foldHeight = 712/3;
public void renderFoldLine(PDPageContentStream contentStream, PDRectangle paper, String foldCode) {
if(foldCode.equals("") && !foldCode.equals("01") && !foldCode.equals("02")) {
return;
}
float paperWidth = paper.getWidth();
float bottomFold = foldHeight; //하단접는곳
float topFold = foldHeight * 2; //상단접는곳
float partHeight;
if(foldCode.equals("01")) {
if(paper.A4.equals(paper)) {
partHeight = 99;
} else {
partHeight = 93;
}
} else {
partHeight = 93;
}
if(paperHeight == 841.8898f) {
bottomFold += 130f;
topFold += 130f;
float margin = 0;
if(foldCode.equals("02")) {
margin = 18;
}
float bottomFold = margin + partHeight; //하단접는곳
float topFold = margin + (partHeight * 2); //상단접는곳
float bottomFold_pt = mmToPt(bottomFold);
float topFold_pt = mmToPt(topFold);
try {
contentStream.setLineDashPattern(new float[]{3,1}, 0);
contentStream.moveTo(0, topFold);
contentStream.lineTo(paperWidth, topFold);
contentStream.moveTo(0, topFold_pt);
contentStream.lineTo(paperWidth, topFold_pt);
contentStream.stroke();
contentStream.moveTo(0, bottomFold);
contentStream.lineTo(paperWidth, bottomFold);
contentStream.moveTo(0, bottomFold_pt);
contentStream.lineTo(paperWidth, bottomFold_pt);
contentStream.stroke();
contentStream.setLineDashPattern(new float[]{}, 0);
} catch (IOException e) {

@ -15,19 +15,19 @@ public class Advntce extends PDFFormat {
public Advntce(){
addForPost(
image("postSenderLogo","우편물송신자로고","").a4(10, 0).letter(0, 0).size(0, 0),
text("postSenderInst","우편물송신자기관","").a4(10, 5).letter(0, 0),
text("postSenderDept","우편물송신자부서","").a4(50, 5).letter(0, 0),
text("postSenderAddr","우편물송신자주소","").a4(10, 15).letter(0, 0),
text("postSenderDtlAddr","우편물송신자상세주소","").a4(10, 25).letter(0, 0),
text("postSenderZip","우편물송신자우편번호","").a4(10, 35).letter(0, 0),
text("postSenderTel","우편물송신자전화번호","").a4(10, 45).letter(0, 0),
text("postSenderFax","우편물송신자팩스번호","").a4(50, 45).letter(0, 0),
image("postSenderLogo","우편물송신자로고","").a4(10, 0).letter(10, 0).size(0, 0),
text("postSenderInst","우편물송신자기관","").a4(10, 5).letter(10, 5),
text("postSenderDept","우편물송신자부서","").a4(50, 5).letter(50, 5),
text("postSenderAddr","우편물송신자주소","").a4(10, 15).letter(10, 15),
text("postSenderDtlAddr","우편물송신자상세주소","").a4(10, 25).letter(10, 25),
text("postSenderZip","우편물송신자우편번호","").a4(10, 35).letter(10, 35),
text("postSenderTel","우편물송신자전화번호","").a4(10, 45).letter(10, 45),
text("postSenderFax","우편물송신자팩스번호","").a4(50, 45).letter(50, 45),
text("postReceiverAddr","우편물수신자주소","").a4(100, 40).letter(0, 0).size(90, 0).align("right"),
text("postReceiverDtlAddr","우편물수신자상세주소","").a4(100, 50).letter(0, 0).size(90, 0).align("right"),
text("postReceiver","우편물수신자명","").a4(100, 60).letter(0, 0).size(90, 0).align("right"),
text("postReceiverZip","우편물수신자우편번호","").a4(100, 70).letter(0, 0).size(90, 0).align("right")
text("postReceiverAddr","우편물수신자주소","").a4(100, 40).letter(100, 40).size(90, 0).align("right"),
text("postReceiverDtlAddr","우편물수신자상세주소","").a4(100, 50).letter(100, 50).size(90, 0).align("right"),
text("postReceiver","우편물수신자명","").a4(100, 60).letter(100, 60).size(90, 0).align("right"),
text("postReceiverZip","우편물수신자우편번호","").a4(100, 70).letter(100, 70).size(90, 0).align("right")
);
add(

@ -65,8 +65,6 @@ import kr.dogfoot.hwplib.writer.HWPWriter;
@Service("sprt01Service")
public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Service {
private Object object;
/** 업무지원 Bean */
@Resource(name="sprt01Bean")
protected Sprt01Bean sprt01Bean;
@ -333,9 +331,6 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
paper = PDRectangle.LETTER;
}
float paperWidth = paper.getWidth();
float paperHeight = paper.getHeight();
OtptStngQuery otptStngQuery = new OtptStngQuery();
otptStngQuery.setSggCd((String) pdfPrintUtil.getPrintRequestUserInfo().getInfo().get("sggCd"));
otptStngQuery.setTaskSeCd(printOption.getTaskSeCd());
@ -350,6 +345,13 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
otptStngQuery.setSndngSeCd(sndngSeCd);
otptStngQuery.setPaperSeCd(paperSeCd);
//출력물 기본 설정
DataObject otptBscStng = otptStngMapper.selectOtptBscStng(otptStngQuery);
if(otptBscStng == null) {
otptBscStng = new DataObject();
}
//출력 요소별 설정
List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(otptStngQuery);
pdfFormat.appendOtptAttribute(otptArtclStngList);
@ -378,12 +380,19 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
// 컨텐츠 스트림 열기
PDPageContentStream contentStream = new PDPageContentStream(doc, page);
//접는곳 점선 그리기
pdfPrintUtil.renderFoldLine(contentStream, paperWidth, paperHeight);
boolean completeFoldLine = false;
for(DataObject otptArtclStng : otptArtclStngList) {
String otptArtclNm = otptArtclStng.string("OTPT_ARTCL_NM");
if(!otptArtclNm.equals("background") && !completeFoldLine) {
//접는곳 점선 그리기
if(!otptBscStng.string("FOLD_LINE_PSTN_SE_CD").equals("")) {
pdfPrintUtil.renderFoldLine(contentStream, paper, otptBscStng.string("FOLD_LINE_PSTN_SE_CD"));
}
completeFoldLine = true;
}
DefaultOtptArtclStng prototypeStng = prototypeStngList.stream()
.filter(item -> item.getOtptArtclNm().equals(otptArtclNm)).toList().get(0);
@ -414,6 +423,12 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
}
if(!completeFoldLine) {
if(!otptBscStng.string("FOLD_LINE_PSTN_SE_CD").equals("")) {
pdfPrintUtil.renderFoldLine(contentStream, paper, otptBscStng.string("FOLD_LINE_PSTN_SE_CD"));
}
}
contentStream.close();
}

@ -196,7 +196,7 @@ function fnMakeScrollableTable(tableScrollEl, thisScrollendEvent){
}
};
var io = new IntersectionObserver(ioCallbackFunc, {threshold : 0.5});
var io = new IntersectionObserver(ioCallbackFunc, {threshold : 0});
io.observe(more);
}

Loading…
Cancel
Save