List of usage examples for com.itextpdf.text Rectangle NO_BORDER
int NO_BORDER
To view the source code for com.itextpdf.text Rectangle NO_BORDER.
Click Source Link
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 w w . ja va 2 s .c om*/ /* 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 w ww. j a v a 2 s .c om 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 {//from w ww .ja v a 2 s . c o 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) {/*from w w w . ja v a2 s.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.solidmaps.webapp.report.LicenseCivilIncludeProductPDF.java
License:Open Source License
private void insertCell(PdfPTable table, String text, int align, Font font, boolean border) { if (text == null) { text = ""; }//from w w w . ja v a 2s . c o m // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), font)); // set the cell alignment cell.setHorizontalAlignment(align); // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } if (!border) { cell.setBorder(Rectangle.NO_BORDER); } // add the call to the table table.addCell(cell); }
From source file:com.thelinh.gui.PreviewExam.java
private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintActionPerformed if (this.txtExamCode.getText().equals("")) { JOptionPane.showMessageDialog(this, "Hy nhp m ?"); } else {//from w w w . ja v a2 s .c o m JFileChooser fc = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("PDF files (*.pdf)", "pdf"); fc.setFileFilter(filter); int rt = fc.showSaveDialog(this); if (rt == JFileChooser.APPROVE_OPTION) { String filepath = fc.getSelectedFile().getPath(); if (filepath.indexOf(".") == -1) { filepath = filepath + ".pdf"; } String dafilepath = (new StringBuffer(filepath)).insert(filepath.length() - 4, ".da").toString(); try { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(filepath)); document.open(); // Add title Paragraph p = new Paragraph("Tr?ng ?i h?c Bch Khoa H Ni", timesBold_25); p.setAlignment(Element.ALIGN_CENTER); p.setSpacingAfter(5); document.add(p); p = new Paragraph("?? thi mn " + this.lbSubject.getText(), timesBold_25); p.setAlignment(Element.ALIGN_CENTER); p.setSpacingAfter(25); document.add(p); p = new Paragraph( "Ng?i ra ?: " + Controller.getCurrentAdmin().getAdminName() + ", Ngy ra ?: " + (new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime())), times_15); p.setAlignment(Element.ALIGN_LEFT); p.setSpacingAfter(5); document.add(p); p = new Paragraph("M ?: " + this.txtExamCode.getText() + " Th?i gian lm bi: " + spTime.getValue().toString() + " pht", timesBold_15); p.setSpacingAfter(25); document.add(p); for (int i = 0; i < this.questionList.size(); i++) { Question question = this.questionList.get(i); ArrayList<Answer> answerList = AnswerSql .getAnswersByQuestionId(question.getQuestionId().trim()); Phrase questionNumber = new Phrase("Cu " + (i + 1) + ": ", timesBold_15); Phrase questionContent = new Phrase(question.getQuestion(), times_15); Paragraph questionTitle = new Paragraph(); questionTitle.add(questionNumber); questionTitle.add(questionContent); document.add(questionTitle); PdfPTable table = new PdfPTable(2); for (int j = 0; j < answerList.size(); j++) { Answer ans = answerList.get(j); Phrase cap = new Phrase(Character.toString((char) (j + 65)) + ". ", timesBold_15); Phrase answerContent = new Phrase(ans.getAnswer(), times_15); Phrase elem = new Phrase(); elem.add(cap); elem.add(answerContent); PdfPCell cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setPhrase(elem); cell.setFixedHeight(25); table.addCell(cell); } document.add(table); } document.close(); // if (Desktop.isDesktopSupported()) { // try { // File myFile = new File(filepath); // Desktop.getDesktop().open(myFile); // } catch (IOException ex) { // // no application registered for PDFs // System.out.println(ex.toString()); // } // } document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dafilepath)); document.open(); // Add title p = new Paragraph("Tr?ng ?i h?c Bch Khoa H Ni", timesBold_25); p.setAlignment(Element.ALIGN_CENTER); p.setSpacingAfter(5); document.add(p); p = new Paragraph("?? thi mn " + this.lbSubject.getText(), timesBold_25); p.setAlignment(Element.ALIGN_CENTER); p.setSpacingAfter(25); document.add(p); p = new Paragraph( "Ng?i ra ?: " + Controller.getCurrentAdmin().getAdminName() + ", Ngy ra ?: " + (new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime())), times_15); p.setAlignment(Element.ALIGN_LEFT); p.setSpacingAfter(5); document.add(p); p = new Paragraph("M ?: " + this.txtExamCode.getText() + " Th?i gian lm bi: " + spTime.getValue().toString() + " pht", timesBold_15); p.setSpacingAfter(25); document.add(p); for (int i = 0; i < this.questionList.size(); i++) { Question question = this.questionList.get(i); ArrayList<Answer> answerList = AnswerSql .getAnswersByQuestionId(question.getQuestionId().trim()); Phrase questionNumber = new Phrase("Cu " + (i + 1) + ": ", timesBold_15); Phrase questionContent = new Phrase(question.getQuestion(), times_15); Paragraph questionTitle = new Paragraph(); questionTitle.add(questionNumber); questionTitle.add(questionContent); document.add(questionTitle); PdfPTable table = new PdfPTable(2); for (int j = 0; j < answerList.size(); j++) { Answer ans = answerList.get(j); Phrase cap = new Phrase(Character.toString((char) (j + 65)) + ". ", timesBold_15); Phrase answerContent = null; if (ans.getYesNo()) { answerContent = new Phrase(ans.getAnswer(), timesBold_15); } else { answerContent = new Phrase(ans.getAnswer(), times_15); } Phrase elem = new Phrase(); elem.add(cap); elem.add(answerContent); PdfPCell cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setPhrase(elem); cell.setFixedHeight(25); table.addCell(cell); } document.add(table); } document.close(); } catch (FileNotFoundException | DocumentException ex) { Logger.getLogger(PreviewExam.class.getName()).log(Level.SEVERE, null, ex); } } } }
From source file:com.tomasz.drag.triballocommanderro.controller.MakerPDF.java
public static PdfPTable createTable(Person person, EventGig event) throws DocumentException, IOException { int a = 0;//w w w . ja va 2 s . c om if (person.getZaladunekScenaDachWyplata() > 0) { a++; } if (person.getZaladunekTechnikiWyplata() > 0) { a++; } if (person.getMontazDachuWyplata() > 0) { a++; } if (person.getMontazDzwiekuWyplata() > 0) { a++; } if (person.getMontazScenyWyplata() > 0) { a++; } if (person.getMontazSwiatlaWyplata() > 0) { a++; } if (person.getMontazTechnikiWyplata() > 0) { a++; } if (person.getDemontazDachuWyplata() > 0) { a++; } if (person.getDemontazDzwiekuWyplata() > 0) { a++; } if (person.getDemontazScenyWyplata() > 0) { a++; } if (person.getDemontazSwiatlaWyplata() > 0) { a++; } if (person.getDemontazTechnikiWyplata() > 0) { a++; } if (person.getRozladunekScenaDachWyplata() > 0) { a++; } if (person.getRozladunekTechnikiWyplata() > 0) { a++; } if (person.getDyzurWyplata() > 0) { a++; } if (person.getTechnikScenyWyplata() > 0) { a++; } if (person.getRealizacjaFOHWyplata() > 0) { a++; } if (person.getRealizacjaMONWyplata() > 0) { a++; } if (person.getRealizacjaSwiatlaWyplata() > 0) { a++; } if (person.getPremia() > 0) { a++; } System.out.println(a); BaseFont bf; bf = BaseFont.createFont("src\\main\\resources\\font\\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); // bf = BaseFont.createFont("arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); com.itextpdf.text.Font ft = new com.itextpdf.text.Font(bf); PdfPTable table = new PdfPTable(2); table.setTotalWidth(new float[] { 90, 190 }); table.setLockedWidth(true); PdfPCell cell; cell = new PdfPCell(new Phrase(person.getName() + " " + person.getSurName(), ft)); cell.setColspan(1); table.addCell(cell); cell = new PdfPCell(new Phrase(event.getName() + " " + event.getData(), ft)); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("")); cell.setRowspan(a); table.addCell(cell); if (person.getZaladunekScenaDachWyplata() > 0) { table.addCell(new Phrase("Zaadunek Scena/Dach", ft)); } if (person.getZaladunekTechnikiWyplata() > 0) { table.addCell(new Phrase("Zaadunek Techniki", ft)); } if (person.getMontazDachuWyplata() > 0) { table.addCell(new Phrase("Monta Dachu", ft)); } if (person.getMontazDzwiekuWyplata() > 0) { table.addCell(new Phrase("Monta Dwieku", ft)); } if (person.getMontazScenyWyplata() > 0) { table.addCell(new Phrase("Monta Sceny", ft)); } if (person.getMontazSwiatlaWyplata() > 0) { table.addCell(new Phrase("Monta wiata", ft)); } if (person.getMontazTechnikiWyplata() > 0) { table.addCell(new Phrase("Monta Techniki", ft)); } if (person.getDemontazDachuWyplata() > 0) { table.addCell(new Phrase("Demonta Dachu", ft)); } if (person.getDemontazDzwiekuWyplata() > 0) { table.addCell(new Phrase("Demonta Dwieku", ft)); } if (person.getDemontazScenyWyplata() > 0) { table.addCell(new Phrase("Demonta Sceny", ft)); } if (person.getDemontazSwiatlaWyplata() > 0) { table.addCell(new Phrase("Demonta wiata", ft)); } if (person.getDemontazTechnikiWyplata() > 0) { table.addCell(new Phrase("Demonta Techniki", ft)); } if (person.getRozladunekScenaDachWyplata() > 0) { table.addCell(new Phrase("Rozadunek Scena/Dach", ft)); } if (person.getRozladunekTechnikiWyplata() > 0) { table.addCell(new Phrase("Rozadunek Techniki", ft)); } if (person.getDyzurWyplata() > 0) { table.addCell(new Phrase("Dyur", ft)); } if (person.getTechnikScenyWyplata() > 0) { table.addCell(new Phrase("Technik Sceny", ft)); } if (person.getRealizacjaFOHWyplata() > 0) { table.addCell(new Phrase("Realizacja FOH", ft)); } if (person.getRealizacjaMONWyplata() > 0) { table.addCell(new Phrase("Realizacja MON", ft)); } if (person.getRealizacjaSwiatlaWyplata() > 0) { table.addCell(new Phrase("Realizacja wiata", ft)); } if (person.getPremia() > 0) { table.addCell(new Phrase("Premia", ft)); } cell = new PdfPCell(new Phrase("Suma: ")); cell.setColspan(1); table.addCell(cell); //cell = new PdfPCell(new Phrase(Double.toString(person.getSumaWyplata())));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata()) cell = new PdfPCell(new Phrase(String.format("%.2f", person.getSumaWyplata()) + " z", ft));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata()) table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); //cell = new PdfPCell(new Phrase(Double.toString(person.getSumaWyplata())));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata()) cell = new PdfPCell(new Phrase(" "));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata()) cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); table.setBreakPoints(2 + a); return table; }
From source file:com.udec.utilidades.PdfTable.java
public PdfPTable firma() throws DocumentException { PdfPTable tabla = new PdfPTable(3); tabla.setWidthPercentage(100);//from w w w . j a va 2 s.c o m tabla.setWidths(new float[] { 2, 1, 2 }); //Declaramos un objeto para manejar las celdas PdfPCell celda; celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.BOTTOM); tabla.addCell(celda); celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.BOTTOM); tabla.addCell(celda); celda = new PdfPCell(new Phrase("JEFE ADMINISTRATIVO")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase("EMPLEADO")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); return tabla; }
From source file:com.udec.utilidades.PdfTable.java
public PdfPTable tabla3(List<Nomina> no) throws DocumentException { //Instanciamos una tabla de 3 columnas PdfPTable tabla = new PdfPTable(4); tabla.setWidthPercentage(100);//from www . j a v a 2s . com tabla.setWidths(new float[] { 1, 3, 1, 1 }); //Declaramos un objeto para manejar las celdas PdfPCell celda; celda = new PdfPCell(new Phrase("CODIGO")); celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); celda.setBorder(Rectangle.BOTTOM); celda.setVerticalAlignment(Element.ALIGN_TOP); celda.setBorderWidth(1); tabla.addCell(celda); celda = new PdfPCell(new Phrase("DESCRIPCION")); celda.setBorder(Rectangle.BOTTOM); celda.setVerticalAlignment(Element.ALIGN_TOP); celda.setBorderWidth(1); celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); tabla.addCell(celda); celda = new PdfPCell(new Phrase("VLR.DEVEN")); celda.setBorder(Rectangle.BOTTOM); celda.setVerticalAlignment(Element.ALIGN_TOP); celda.setBorderWidth(1); celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); celda.setBorderWidth(1); celda.setVerticalAlignment(Element.ALIGN_TOP); tabla.addCell(celda); celda = new PdfPCell(new Phrase("VLR.DEDUC")); celda.setBorder(Rectangle.BOTTOM); celda.setVerticalAlignment(Element.ALIGN_TOP); celda.setBorderWidth(1); celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); tabla.addCell(celda); double totalDev = 0, totalDed = 0; for (Nomina nomina : no) { celda = new PdfPCell(new Phrase("" + nomina.getConceptoIdconcepto().getCodigo())); celda.setBorder(Rectangle.NO_BORDER); celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); tabla.addCell(celda); celda = new PdfPCell(new Phrase("" + nomina.getConceptoIdconcepto().getConcepto())); celda.setBorder(Rectangle.NO_BORDER); celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); tabla.addCell(celda); if (nomina.getConceptoIdconcepto().getTipo().equals("DEVENGADO")) { totalDev += nomina.getValor(); celda = new PdfPCell(new Phrase("" + nomina.getValor())); celda.setBorder(Rectangle.NO_BORDER); celda.setHorizontalAlignment(Element.ALIGN_RIGHT); tabla.addCell(celda); } else { celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); } if (nomina.getConceptoIdconcepto().getTipo().equals("DEDUCIDO")) { totalDed += nomina.getValor(); celda = new PdfPCell(new Phrase("" + nomina.getValor())); celda.setBorder(Rectangle.NO_BORDER); celda.setHorizontalAlignment(Element.ALIGN_RIGHT); tabla.addCell(celda); } else { celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); } } celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase("TOTALES")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase("" + totalDev)); celda.setHorizontalAlignment(Element.ALIGN_RIGHT); celda.setBorder(Rectangle.TOP); tabla.addCell(celda); celda = new PdfPCell(new Phrase(" " + totalDed)); celda.setHorizontalAlignment(Element.ALIGN_RIGHT); celda.setBorder(Rectangle.TOP); tabla.addCell(celda); celda = new PdfPCell(new Phrase("")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase("NETO A PAGAR")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); celda = new PdfPCell(new Phrase(" " + (totalDev - totalDed))); celda.setBorder(Rectangle.NO_BORDER); celda.setHorizontalAlignment(Element.ALIGN_RIGHT); tabla.addCell(celda); celda = new PdfPCell(new Phrase(" ")); celda.setBorder(Rectangle.NO_BORDER); tabla.addCell(celda); return tabla; }
From source file:com.vectorprint.report.itext.style.ZebraStripes.java
License:Open Source License
protected void paintRow(int row, Rectangle rect, PdfContentByte[] canvases, boolean last, boolean first) { if (settings.getBooleanProperty(false, DEBUG)) { DebugHelper.debugBackground(canvases[PdfPTable.BACKGROUNDCANVAS], rect, itextHelper.fromColor(rowBackgroundColor), "zebra", settings, layerManager); return;/* w w w .j av a 2 s . co m*/ } rect.setBackgroundColor(itextHelper.fromColor(rowBackgroundColor)); rect.setBorder(Rectangle.NO_BORDER); canvases[PdfPTable.BACKGROUNDCANVAS].rectangle(rect); }