List of usage examples for com.itextpdf.text Rectangle BOX
int BOX
To view the source code for com.itextpdf.text Rectangle BOX.
Click Source Link
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document ESingnature(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> ESingnature "); try {/*w ww .j ava 2s. co m*/ document.newPage(); PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); PdfPCell c1 = new PdfPCell(new Phrase("E-singnature ")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } Iterator itr = null; CandidateESignature esignature = new CandidateESignature(); if (addressbook.getCandidateESignatures().size() > 0) { itr = addressbook.getCandidateESignatures().iterator(); esignature = (CandidateESignature) itr.next(); } c1 = new PdfPCell(new Phrase("Branch : " + esignature.getBranch(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Servicing Department : " + esignature.getServiceDepartment(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("City : " + esignature.getCity(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Agent Code : " + esignature.getAgentId(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int i = 0; i < 4; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } document.add(table); table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); table.setWidths(new int[] { 80, 20 }); c1 = new PdfPCell(new Phrase("Presently attached with another insurance Company ? ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t No", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Presently in contact with any other AIA'S servicing Department ? ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t No", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Taken LOMBRA occupational test or PSP test in the past ? If Yes, ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t No", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Please provide the result. ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 5; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } document.add(table); Paragraph para1 = new Paragraph(); para1.add(new Chunk("Applicant's Declaration ", font)); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); for (int i = 0; i < 4; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Application Date", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Applicant/Candidate Name :", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); if (esignature.getApplicationDate() != null) { c1 = new PdfPCell(new Phrase(format.format(esignature.getApplicationDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } else { c1 = new PdfPCell(new Phrase("", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase(esignature.getCandidateName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 4; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } document.add(table); para1 = new Paragraph(); para1.add(new Chunk("E-Signature : ", font)); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); if (esignature.geteSignaturePhoto() != null) { Image image = Image.getInstance(esignature.geteSignaturePhoto()); para1 = new Paragraph(); para1.add(image); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); } else { para1 = new Paragraph(); para1.add(""); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); } } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> ESingnature " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document personalCertification(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalCertification "); try {//from w w w. j a va 2s . com /* New Page */ document.newPage(); PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); int i = 0; for (Iterator itr = addressbook.getCandidateProfessionalCertifications().iterator(); itr.hasNext();) { CandidateProfessionalCertification procertification = (CandidateProfessionalCertification) itr .next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("PERSONAL CERTIFICATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Certificate Name: " + procertification.getCertificateName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Chrater Agency: " + procertification.getCharterAgency(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Charter Date : " + format.format(procertification.getCharterDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalCertification " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document Education(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> Education "); try {//from w ww .j a v a2s. c o m /* New Page */ document.newPage(); PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); int i = 0; for (Iterator itr = addressbook.getCandidateEducations().iterator(); itr.hasNext();) { CandidateEducation candidateEducation = (CandidateEducation) itr.next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("EDUCATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Start Date: " + format.format(candidateEducation.getStartDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("End Date: " + format.format(candidateEducation.getEndDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Witness : " + candidateEducation.getWitness(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Education : " + candidateEducation.getEducation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Education Level : " + candidateEducation.getEducationLevel(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("School : " + candidateEducation.getSchool(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Witness Contect Number : " + candidateEducation.getWitnessContactNo(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> Education " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document workExperience(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> workExperience "); try {/*from www. j av a 2s.co m*/ document.newPage(); PdfPTable table = new PdfPTable(3); table.setSpacingBefore(10); table.setWidthPercentage(100f); int i = 0; for (Iterator itr = addressbook.getCandidateWorkExperiences().iterator(); itr.hasNext();) { CandidateWorkExperience candidateWorkExp = (CandidateWorkExperience) itr.next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("WORK EXPERIENCE")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Start Date: " + format.format(candidateWorkExp.getStartDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("End Date: " + format.format(candidateWorkExp.getEndDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Witness: " + candidateWorkExp.getWitness(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Unit : " + candidateWorkExp.getUnit(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Occupation : " + candidateWorkExp.getOccupation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Witness Contect Number : \n\n\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + candidateWorkExp.getWitnessContactNo(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(25f); //c1.setPaddingBottom(10f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Income : " + candidateWorkExp.getIncome(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Possition : " + candidateWorkExp.getPosition(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> workExperience " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document familyInformation(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> familyInformation "); try {//ww w . ja v a2 s .co m /* New Page */ document.newPage(); PdfPTable table = new PdfPTable(3); table.setSpacingBefore(10); table.setWidthPercentage(100f); //Set familylist=addressbook.getCandidateFamilyInfos(); int i = 0; for (Iterator itr = addressbook.getCandidateFamilyInfos().iterator(); itr.hasNext();) { CandidateFamilyInfo candidateFamilyInfo = (CandidateFamilyInfo) itr.next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("FAMILY INFORMATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Name: " + candidateFamilyInfo.getName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Unit: " + candidateFamilyInfo.getUnit(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Possition: " + candidateFamilyInfo.getPosition(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Relationship : " + candidateFamilyInfo.getRelationship(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Occupation : " + candidateFamilyInfo.getOccupation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Phone : " + candidateFamilyInfo.getPhoneNo(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> familyInformation " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document personalInformation(Document document, PdfWriter writer, AddressBook addressbook, Font normalFontCH) {/*w w w . j a v a2s .c om*/ // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalInformation "); try { PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); PdfPCell c1 = new PdfPCell(new Phrase("PERSONAL INFORMATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Candidate's Name: " + addressbook.getName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("NRIC: " + addressbook.getNric(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("??* ", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("???(*) ", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Date of Birth: " + format.format(addressbook.getBirthDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Gender: " + addressbook.getGender(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Age: " + addressbook.getAge(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Place of Birth: " + addressbook.getBirthPlace(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("(*)", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Education: " + addressbook.getEducation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Maritial Status: " + addressbook.getMarritalStatus(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Annual Income: " + addressbook.getYearlyIncome(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Work Experience: " + addressbook.getWorkingYearExperience(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase( "Address : " + addressbook.getResidentialAddress1() + " ," + addressbook.getResidentialAddress2() + " , " + addressbook.getResidentialAddress3(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("??*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Postal Code: " + addressbook.getResidentialPostalCode(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Mobile Number: " + addressbook.getMobilePhoneNo(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("??*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Email Address: " + addressbook.geteMailId(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); c1.setLeading(4f, 0f); table.addCell(c1); document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalInformation " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static void addTitle(Document document, PdfWriter writer, String fieldName, String headerText) throws Exception, IOException, BadElementException { log.log(Level.INFO, "ApplicationFormPDFMaintenance --> addTitle "); PdfPTable table = new PdfPTable(2); PdfPCell c1 = new PdfPCell(new Phrase(headerText)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); c1.setVerticalAlignment(Element.ALIGN_CENTER); //c1.setBackgroundColor(BaseColor.RED); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f);/*from ww w.j a v a2 s . c om*/ c1.setColspan(2); table.addCell(c1); table.setWidthPercentage(100f); document.add(table); }
From source file:com.softwaremagico.tm.pdf.complete.elements.TableBorderEvent.java
License:Open Source License
@Override public void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvas) {/* w w w . j av a2 s . c o m*/ float width[] = widths[0]; float x1 = width[0]; float x2 = width[width.length - 1]; float y1 = heights[0]; float y2 = heights[heights.length - 1]; PdfContentByte cb = canvas[PdfPTable.LINECANVAS]; Rectangle rect1 = new Rectangle(x1, y1, x2, y2); rect1.setBorder(Rectangle.BOX); rect1.setBorderWidth(2); cb.rectangle(rect1); cb.stroke(); }
From source file:com.vectorprint.report.itext.debug.DebugHelper.java
License:Open Source License
/** * When in debugging mode, adds a border to the image and calls {@link VectorPrintDocument#addHook(com.vectorprint.report.itext.VectorPrintDocument.AddElementHook) * } to be able to print debugging info and link for the image * * @param canvas/*from w ww . j a v a 2 s . co m*/ * @param img * @param bordercolor * @param styleClass * @param extraInfo * @param settings * @param layerAware * @param document */ public static void debugImage(PdfContentByte canvas, Image img, Color bordercolor, String styleClass, String extraInfo, EnhancedMap settings, LayerManager layerAware, VectorPrintDocument document) { if (null != img) { img.setBorder(Rectangle.BOX); img.setBorderWidth(0.3f); img.setBorderColor(itextHelper.fromColor(bordercolor)); if (styleClass == null) { log.warning("not showing link to styleClass because there is no styleClass"); return; } img.setAnnotation(new Annotation(DEBUG, "click for link to styleClass information (" + styleClass + extraInfo + ")")); document.addHook(new VectorPrintDocument.AddElementHook( VectorPrintDocument.AddElementHook.INTENTION.DEBUGIMAGE, img, null, styleClass)); } }
From source file:Controlador.EmailWithPdf.java
/** * Writes the content of a PDF file (using iText API) * to the {@link OutputStream}./*from ww w.j a v a 2 s. c o m*/ * @param outputStream {@link OutputStream}. * @throws Exception */ public void writePdf(OutputStream outputStream) throws Exception { Document document = new Document(PageSize.LETTER, 50, 50, 50, 30); Font boldFontTitulo = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD); Font boldFontTexto = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD); Font FontTexto = new Font(Font.FontFamily.HELVETICA, 12); // document.setPageSize(null); PdfWriter writer = PdfWriter.getInstance(document, outputStream); Image imagen = Image.getInstance("D:\\ALEX\\Bseguros\\web\\img\\Aseguradoras\\BSeguroLogo.png"); Image imagen2 = Image.getInstance("D:\\ALEX\\Bseguros\\web\\img\\Aseguradoras\\mapfre.png"); DateFormat df = new SimpleDateFormat("dd/MM/YYYY"); Calendar cdos = Calendar.getInstance(); Date datediamas = new Date(); Date dateaniomas = new Date(); cdos.add(Calendar.DATE, 1); datediamas = cdos.getTime(); String fechadiamas = df.format(datediamas); cdos.add(Calendar.YEAR, 1); dateaniomas = cdos.getTime(); String fechavencimiento = df.format(dateaniomas); document.open(); PdfContentByte canvas = writer.getDirectContent(); Rectangle rect = new Rectangle(36, 36, 579, 756); rect.setBorder(Rectangle.BOX); rect.setBorderWidth(2); canvas.rectangle(rect); // Rectangle rect= new Rectangle(36,108); // rect.setBorder(Rectangle.BOX); // //rect.setBorderColor(BaseColor.BLACK); //rect.setBorderWidth(2); //document.add(rect); document.addTitle("Cotizacion"); document.addSubject("Cotizacion"); document.addKeywords("Cotizacion, seguros"); document.addAuthor("BSeguro"); document.addCreator("Bseguro"); imagen.scaleAbsoluteHeight(30f); imagen.setAbsolutePosition(45f, 720f); imagen2.scaleAbsoluteHeight(30f); imagen2.setAbsolutePosition(450f, 720f); document.add(imagen); document.add(imagen2); Paragraph paragraph2 = new Paragraph("DATOS DE TU POLIZA" + fechadiamas + " hasta: " + fechavencimiento, boldFontTitulo); Paragraph paragraph3 = new Paragraph( "DhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhATOS DE TU POLIZA", boldFontTitulo); paragraph2.setAlignment(Element.ALIGN_CENTER); document.add(paragraph2); document.add(paragraph3); document.close(); }