List of usage examples for com.lowagie.text Phrase Phrase
public Phrase()
Phrase
without specifying a leading. From source file:com.krawler.spring.hrms.exportreport.exportAppraisalReportPDFDAOImpl.java
License:Open Source License
private ByteArrayOutputStream AppraisalDetail(HttpServletRequest request, Session session, boolean isEmm, String str, String goalstr, String quesansstr) throws JSONException, SessionExpiredException, DocumentException, ServiceException, IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); String[] colHeader = {// w w w . j a va 2 s . c o m messageSource.getMessage("hrms.common.employee.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.cycle.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.start.date", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.end.date", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.total.appraisals", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.common.Updates.NoofAppraisalsSubmitted", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.overall.self.comments", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.overall.appraiser.comments", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.overall.competency.score", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.competencies", null, RequestContextUtils.getLocale(request)) }; String[] colHeader1 = { messageSource.getMessage("hrms.common.employee.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.cycle.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.start.date", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.end.date", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.total.appraisals", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.common.Updates.NoofAppraisalsSubmitted", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.overall.appraiser.comments", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.overall.competency.score", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.competencies", null, RequestContextUtils.getLocale(request)) }; String[] colHeader2 = { messageSource.getMessage("hrms.common.employee.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.cycle.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.start.date", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraisal.end.date", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.total.appraisals", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.common.Updates.NoofAppraisalsSubmitted", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.overall.competency.score", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.competencies", null, RequestContextUtils.getLocale(request)) }; String[] dataIndex = { "empname", "appcylename", "appcylestdate", "appcylendate", "totalappraisal", "appraisalsubmitted", "empcomment", "mancom", "manavgwght", "" }; String[] dataIndex1 = { "empname", "appcylename", "appcylestdate", "appcylendate", "totalappraisal", "appraisalsubmitted", "mancom", "manavgwght", "" }; String[] dataIndex2 = { "empname", "appcylename", "appcylestdate", "appcylendate", "totalappraisal", "appraisalsubmitted", "manavgwght", "" }; String[] compHeader = { messageSource.getMessage("hrms.common.name", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.description", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.self.appraisal.score", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.self.appraisal.comment", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraiser.competency.score", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraiser.comments", null, RequestContextUtils.getLocale(request)) }; String[] compDataIndex = { "comptename", "comptdesc", "selfcompscore", "selfcomment", "compmanwght" }; String[] compGoalHeader = { messageSource.getMessage("hrms.performance.goals", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.common.assigned.by", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraiser.rating", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraiser.comment", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.self.rating", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.self.comments", null, RequestContextUtils.getLocale(request)) }; String[] compGoalDataIndex = { "gname", "assignedby", "gmanrat", "mangoalcomment", "gemprat", "empgoalcomment" }; String[] quesAnsHeader1 = { messageSource.getMessage("hrms.performance.Questions", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraiser.response", null, RequestContextUtils.getLocale(request)) }; String[] quesAnsHeader = { messageSource.getMessage("hrms.performance.Questions", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.appraiser.response", null, RequestContextUtils.getLocale(request)), messageSource.getMessage("hrms.performance.self.response", null, RequestContextUtils.getLocale(request)) }; String[] quesAnsDataIndex = { hrmsAnonymousAppraisalConstants.question, hrmsAnonymousAppraisalConstants.answer, hrmsAnonymousAppraisalConstants.employeeanswer }; String[] quesAnsDataIndex1 = { hrmsAnonymousAppraisalConstants.question, hrmsAnonymousAppraisalConstants.answer }; String managerComments = ""; String scoreAvg = ""; String companyid = null; PdfWriter writer = null; try { String usID = request.getParameter("userid"); String self = request.getParameter("self"); Boolean removecolumn = false; if (!StringUtil.isNullOrEmpty(self) && self.equals("false")) { quesAnsHeader = quesAnsHeader1; quesAnsDataIndex = quesAnsDataIndex1; colHeader = colHeader1; dataIndex = dataIndex1; removecolumn = true; } if (StringUtil.isNullOrEmpty(usID)) { usID = sessionHandlerImplObj.getUserid(request); } if (StringUtil.isNullOrEmpty(request.getParameter("pdfEmail"))) companyid = sessionHandlerImplObj.getCompanyid(request); else { User u = (User) hibernateTemplate.get(User.class, usID); companyid = u.getCompany().getCompanyID(); } HashMap<String, Object> requestParams = new HashMap<String, Object>(); // companyid = sessionHandlerImplObj.getCompanyid(request); requestParams.put("companyid", companyid); requestParams.put("checklink", "appraisal"); if (!hrmsCommonDAOObj.checkModule(requestParams).isSuccessFlag()) { quesAnsHeader = quesAnsHeader1; quesAnsDataIndex = quesAnsDataIndex1; colHeader = colHeader1; removecolumn = true; } requestParams.clear(); requestParams.put("companyid", companyid); requestParams.put("checklink", "overallcomments"); if (!hrmsCommonDAOObj.checkModule(requestParams).isSuccessFlag()) { colHeader = colHeader2; dataIndex = dataIndex2; } requestParams.clear(); Document document = new Document(PageSize.A4.rotate(), 25, 25, 25, 25); writer = PdfWriter.getInstance(document, baos); writer.setPageEvent(new EndPage()); document.open(); java.awt.Color tColor = new Color(9, 9, 9); //fontSmallBold.setColor(tColor); Paragraph p = new Paragraph(); PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100); table.setWidths(new float[] { 55, 75 }); PdfPTable mainTable = new PdfPTable(1); mainTable.setTotalWidth(90); mainTable.setWidthPercentage(100); mainTable.setSpacingBefore(20); PdfPCell headcell = null; headcell = new PdfPCell( new Paragraph(fontFamilySelector.process( messageSource.getMessage("hrms.performance.appraisal.details", null, RequestContextUtils.getLocale(request)), FontContext.REGULAR_BOLD_HELVETICA, tColor))); headcell.setBackgroundColor(new Color(0xEEEEEE)); headcell.setPadding(5); mainTable.addCell(headcell); document.add(mainTable); // String str=hrmsManager.getAppraisalReport(session, request); JSONObject jobjTemplate = new JSONObject(str); com.krawler.utils.json.base.JSONArray jarr = jobjTemplate.getJSONArray("data"); com.krawler.utils.json.base.JSONArray jarr2 = jarr.getJSONObject(0).getJSONArray("data"); JSONObject jobjAppraisal = new JSONObject(jarr2.getString(0)); jarr = jobjAppraisal.getJSONArray("competencies"); int headlen = colHeader.length; if (jarr.length() < 1) { headlen = headlen - 2; } for (int i = 0; i < headlen; i++) { PdfPCell pcell = new PdfPCell( new Paragraph(fontFamilySelector.process(colHeader[i], FontContext.MEDIUM_BOLD_HELVETICA))); pcell.setBorder(0); if (i == 0) pcell.setPaddingTop(10); pcell.setPaddingLeft(15); pcell.setPaddingBottom(4); pcell.setBorderColor(new Color(0xF2F2F2)); pcell.setHorizontalAlignment(Element.ALIGN_LEFT); pcell.setVerticalAlignment(Element.ALIGN_LEFT); table.addCell(pcell); if (!dataIndex[i].equals("mancom")) { pcell = new PdfPCell(new Paragraph(fontFamilySelector.process(!dataIndex[i].equals("") ? !jobjAppraisal.isNull(dataIndex[i]) ? jobjAppraisal.getString(dataIndex[i]) : "" : "", FontContext.SMALL_NORMAL_HELVETICA))); if (i == 0) pcell.setPaddingTop(10); pcell.setBorder(0); pcell.setPaddingLeft(10); pcell.setPaddingBottom(4); pcell.setBorderColor(new Color(0xF2F2F2)); pcell.setHorizontalAlignment(Element.ALIGN_LEFT); pcell.setVerticalAlignment(Element.ALIGN_LEFT); table.addCell(pcell); } else { if (!jobjAppraisal.isNull(dataIndex[i])) { JSONArray spl = new JSONArray(jobjAppraisal.getString(dataIndex[i])); String strData = ""; for (int counter = 0; counter < spl.length(); counter++) { strData += spl.getString(counter) + "\n"; } pcell = new PdfPCell(new Paragraph( fontFamilySelector.process(strData, FontContext.SMALL_NORMAL_HELVETICA))); if (i == 0) pcell.setPaddingTop(10); pcell.setBorder(0); pcell.setPaddingLeft(10); pcell.setPaddingBottom(4); pcell.setBorderColor(new Color(0xF2F2F2)); pcell.setHorizontalAlignment(Element.ALIGN_LEFT); pcell.setVerticalAlignment(Element.ALIGN_LEFT); table.addCell(pcell); } } } document.add(table); PdfPTable quesansTable = new PdfPTable(quesAnsHeader.length); quesansTable.setWidthPercentage(100); if (removecolumn) { quesansTable.setWidths(new float[] { 40, 40 }); } else { quesansTable.setWidths(new float[] { 40, 40, 40 }); } quesansTable.setSpacingBefore(20); quesansTable.setHeaderRows(1); for (int i = 0; i < quesAnsHeader.length; i++) { PdfPCell pgcell = new PdfPCell(new Paragraph( fontFamilySelector.process(quesAnsHeader[i], FontContext.MEDIUM_BOLD_HELVETICA))); pgcell.setBorder(0); pgcell.setBorder(PdfPCell.BOX); pgcell.setPadding(4); pgcell.setBorderColor(Color.GRAY); pgcell.setHorizontalAlignment(Element.ALIGN_CENTER); quesansTable.addCell(pgcell); } JSONObject quesansjobj = new JSONObject(quesansstr); JSONArray quesansjarr = quesansjobj.getJSONArray("quesans"); JSONObject qajobj = new JSONObject(); for (int i = 0; i < quesansjarr.length(); i++) { qajobj = quesansjarr.getJSONObject(i); for (int k = 0; k < quesAnsHeader.length; k++) { String qatext = !qajobj.isNull(quesAnsDataIndex[k]) ? qajobj.getString(quesAnsDataIndex[k]) : ""; qatext = qatext.replaceAll("~", "\n\n"); qatext = qatext.replaceAll("\n", "<br/>"); StyleSheet st = new StyleSheet(); st.loadTagStyle("body", "face", "HELVETICA"); st.loadTagStyle("body", "size", "1"); st.loadTagStyle("body", "leading", "8,0"); StringReader stringReader = new StringReader(qatext); PdfPCell pcell = new PdfPCell(); ArrayList listStr = HTMLWorker.parseToList(stringReader, st); pcell.setPadding(4); for (int htmlCount = 0; htmlCount < listStr.size(); ++htmlCount) { if (!listStr.get(htmlCount).toString().equals("[]")) pcell.addElement((Element) listStr.get(htmlCount)); } pcell.setBorder(PdfPCell.BOTTOM | PdfPCell.LEFT | PdfPCell.RIGHT); pcell.setBorderColor(Color.GRAY); pcell.setPadding(4); pcell.setHorizontalAlignment(Element.ALIGN_LEFT); pcell.setVerticalAlignment(Element.ALIGN_CENTER); quesansTable.addCell(pcell); } } document.add(quesansTable); PdfPTable compTable = new PdfPTable(6); compTable.setWidthPercentage(100); compTable.setWidths(new float[] { 50, 60, 30, 50, 42, 70 }); compTable.setSpacingBefore(20); compTable.setHeaderRows(1); for (int i = 0; i < compHeader.length; i++) { PdfPCell pcell = new PdfPCell(new Paragraph( fontFamilySelector.process(compHeader[i], FontContext.MEDIUM_BOLD_HELVETICA))); pcell.setBorder(0); pcell.setBorder(PdfPCell.BOX); pcell.setPadding(4); pcell.setBorderColor(Color.GRAY); pcell.setHorizontalAlignment(Element.ALIGN_CENTER); compTable.addCell(pcell); } for (int i = 0; i < jarr.length(); i++) { jobjAppraisal = jarr.getJSONObject(i); for (int k = 0; k < compHeader.length; k++) { if (k != compHeader.length - 1) { scoreAvg = ""; if (!jobjAppraisal.isNull(compDataIndex[k]) && compDataIndex[k].equals("compmanwght")) { scoreAvg = jobjAppraisal.getString("nominalRat"); Chunk chunk1 = fontFamilySelector.processChunk( jobjAppraisal.getString(compDataIndex[k]) + "\n\n", FontContext.SMALL_NORMAL_HELVETICA); Chunk chunk2 = null; requestParams.clear(); if (!StringUtil.isNullOrEmpty(request.getParameter("pdfEmail"))) { // User user=(User)session.get(User.class,request.getParameter("userid")); // companyid=user.getCompany().getCompanyID(); requestParams.put("companyid", companyid); requestParams.put("checklink", "modaverage"); if (hrmsCommonDAOObj.checkModule(requestParams).isSuccessFlag()) { chunk2 = fontFamilySelector.processChunk("[" + messageSource.getMessage("hrms.performance.mod.avg", null, RequestContextUtils.getLocale(request)) + ": " + scoreAvg + " ]", FontContext.SMALL_NORMAL_HELVETICA); } else { chunk2 = fontFamilySelector.processChunk("[" + messageSource.getMessage("hrms.performance.avg", null, RequestContextUtils.getLocale(request)) + ": " + scoreAvg + " ]", FontContext.SMALL_NORMAL_HELVETICA); } } else { requestParams.put("companyid", companyid); requestParams.put("checklink", "modaverage"); if (hrmsCommonDAOObj.checkModule(requestParams).isSuccessFlag()) { chunk2 = fontFamilySelector.processChunk("[" + messageSource.getMessage("hrms.performance.mod.avg", null, RequestContextUtils.getLocale(request)) + ": " + scoreAvg + " ]", FontContext.SMALL_NORMAL_HELVETICA); } else { chunk2 = fontFamilySelector.processChunk("[" + messageSource.getMessage("hrms.performance.avg", null, RequestContextUtils.getLocale(request)) + ": " + scoreAvg + " ]", FontContext.SMALL_NORMAL_HELVETICA); } } Phrase phrase1 = new Phrase(); phrase1.add(chunk1); phrase1.add(chunk2); p = new Paragraph(); p.add(phrase1); } PdfPCell pcell = new PdfPCell(); if (!scoreAvg.equals("")) { pcell = new PdfPCell(new Paragraph(p)); pcell.setPadding(0); pcell.setPaddingTop(2); pcell.setPaddingBottom(4); } else { if (!jobjAppraisal.isNull(compDataIndex[k])) { String htmlStr = jobjAppraisal.getString(compDataIndex[k]); htmlStr = htmlStr.replaceAll("\n", "<br>"); StyleSheet st = new StyleSheet(); st.loadTagStyle("body", "face", "HELVETICA"); st.loadTagStyle("body", "size", "1"); st.loadTagStyle("body", "leading", "8,0"); HTMLWorker worker = new HTMLWorker(document); StringReader stringReader = new StringReader(htmlStr); ArrayList<Element> listStr = HTMLWorker.parseToList(stringReader, st); pcell.setPadding(4); for (int htmlCount = 0; htmlCount < listStr.size(); ++htmlCount) { if (!listStr.get(htmlCount).getChunks().isEmpty()) { pcell.addElement(fontFamilySelector.processElement( listStr.get(htmlCount).getChunks(), FontContext.SMALL_NORMAL_HELVETICA)); } } } else pcell = new PdfPCell(new Paragraph(fontFamilySelector.process( !jobjAppraisal.isNull(compDataIndex[k]) ? StringUtil .serverHTMLStripper(jobjAppraisal.getString(compDataIndex[k])) : "", FontContext.SMALL_NORMAL_HELVETICA))); } pcell.setBorder(PdfPCell.BOTTOM | PdfPCell.LEFT | PdfPCell.RIGHT); pcell.setBorderColor(Color.GRAY); pcell.setHorizontalAlignment( compDataIndex[k].equals("comptename") || compDataIndex[k].equals("comptdesc") || compDataIndex[k].equals("selfcomment") ? Element.ALIGN_LEFT : Element.ALIGN_CENTER); pcell.setVerticalAlignment( compDataIndex[k].equals("comptdesc") || compDataIndex[k].equals("comptdesc") || compDataIndex[k].equals("selfcomment") ? Element.ALIGN_LEFT : Element.ALIGN_CENTER); compTable.addCell(pcell); } else { jarr2 = jobjAppraisal.getJSONArray("comments"); managerComments = ""; int commentCount = 1; for (int j = jarr2.length() - 1; j >= 0; j--) { jobjTemplate = jarr2.getJSONObject(j); managerComments += commentCount + ") " + jobjTemplate.getString("managercomment") + "\n\n"; commentCount++; } PdfPCell pcell = new PdfPCell(new Paragraph( fontFamilySelector.process(managerComments, FontContext.SMALL_NORMAL_HELVETICA))); pcell.setBorder(PdfPCell.BOTTOM | PdfPCell.LEFT | PdfPCell.RIGHT); pcell.setPadding(4); pcell.setBorderColor(Color.GRAY); pcell.setHorizontalAlignment(Element.ALIGN_LEFT); pcell.setVerticalAlignment(Element.ALIGN_LEFT); compTable.addCell(pcell); } } } document.add(compTable); PdfPCell pcell; if (jarr.length() > 0) { PdfPTable helpTable = new PdfPTable(1); helpTable.setTotalWidth(90); helpTable.setWidthPercentage(100); helpTable.setSpacingBefore(20); pcell = new PdfPCell(new Paragraph(fontFamilySelector.process( messageSource.getMessage("hrms.performance.mod.avg", null, RequestContextUtils.getLocale(request)) + ". : " + messageSource.getMessage("hrms.performance.mode.average.ratings", null, RequestContextUtils.getLocale(request)), FontContext.SMALL_BOLD_HELVETICA))); pcell.setBorder(0); pcell.setPadding(4); pcell.setHorizontalAlignment(Element.ALIGN_LEFT); helpTable.addCell(pcell); requestParams.clear(); requestParams.put("companyid", companyid); requestParams.put("checklink", "modaverage"); if (!StringUtil.isNullOrEmpty(request.getParameter("pdfEmail"))) { if (hrmsCommonDAOObj.checkModule(requestParams).isSuccessFlag()) { document.add(helpTable); } } else { if (hrmsCommonDAOObj.checkModule(requestParams).isSuccessFlag()) { document.add(helpTable); } } } PdfPTable compgTable = new PdfPTable(6); compgTable.setWidthPercentage(100); compgTable.setWidths(new float[] { 50, 60, 30, 50, 42, 70 }); compgTable.setSpacingBefore(20); compgTable.setHeaderRows(1); for (int i = 0; i < compGoalHeader.length; i++) { PdfPCell pgcell = new PdfPCell(new Paragraph( fontFamilySelector.process(compGoalHeader[i], FontContext.MEDIUM_BOLD_HELVETICA))); pgcell.setBorder(0); pgcell.setBorder(PdfPCell.BOX); pgcell.setPadding(4); pgcell.setBorderColor(Color.GRAY); pgcell.setHorizontalAlignment(Element.ALIGN_CENTER); compgTable.addCell(pgcell); } JSONObject jobjTemplates = new JSONObject(goalstr); com.krawler.utils.json.base.JSONArray jarr11 = jobjTemplates.getJSONArray("data"); JSONObject jobjl = new JSONObject(); for (int i = 0; i < jarr11.length(); i++) { jobjl = jarr11.getJSONObject(i); for (int k = 0; k < compHeader.length; k++) { pcell = new PdfPCell( new Paragraph( fontFamilySelector.process( !jobjl.isNull(compGoalDataIndex[k]) ? StringUtil .serverHTMLStripper(jobjl.getString(compGoalDataIndex[k])) : "", FontContext.SMALL_NORMAL_HELVETICA))); pcell.setBorder(PdfPCell.BOTTOM | PdfPCell.LEFT | PdfPCell.RIGHT); pcell.setBorderColor(Color.GRAY); pcell.setPadding(4); pcell.setHorizontalAlignment(Element.ALIGN_CENTER); pcell.setVerticalAlignment(Element.ALIGN_CENTER); compgTable.addCell(pcell); } } document.add(compgTable); document.newPage(); document.close(); } catch (DocumentException ex) { ex.printStackTrace(); throw ServiceException.FAILURE("AppraisalDetails.AppraisalDetail", ex); } catch (JSONException e) { e.printStackTrace(); throw ServiceException.FAILURE("AppraisalDetails.AppraisalDetail", e); } catch (Exception ex) { ex.printStackTrace(); throw ServiceException.FAILURE(ex.getMessage(), ex); } finally { writer.close(); } return baos; }
From source file:com.sinkluge.reports.contracts.GenContractChecklist.java
public void create(Info in, Image toplogo) throws Exception { //adds the unchecked box Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg"); Chunk ch2 = new Chunk(checkbox, -10, -10); Phrase checkboxPhrase = new Phrase(); checkboxPhrase.add(ch2);//from ww w.j a v a 2s . c o m int[] two = { 10, 90 };//sets the widths of the columns(2) with checkboxes //blank spacer for keeping tables apart Table spacer = new Table(1, 1); spacer.setBorderWidth(0); //spacer.setDefaultCellBorderWidth(0); spacer.setWidth(100); spacer.setPadding(0); spacer.setSpacing(0); Cell blank = new Cell(); blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 1, Font.BOLD, new Color(255, 255, 255)))); blank.setBorderWidth(0); blank.setLeading(0); spacer.addCell(blank); init(); //document.setMargins(left, right, top, bottom); //add image Phrase p1 = new Phrase(); int[] widths = { 60, 40 }; Table table1 = new Table(2, 1); table1.setWidths(widths); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(2); table1.setSpacing(2); toplogo.scalePercent(20); //Chunk ch1=new Chunk(toplogo, -10, -80); Cell cell = new Cell(toplogo); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); //just added image //add title on right side cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("\n" + title + " Checklist", new Font(Font.TIMES_ROMAN, 18, Font.BOLD))); cell.add(new Phrase("\n" + currentDate, new Font(Font.TIMES_ROMAN, 16, Font.BOLD))); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); //add "To:" and "Re:" table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); cell = new Cell(); p1 = new Phrase("To:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD)); cell.setVerticalAlignment("middle"); cell.add(p1); cell.add(new Phrase("\t\t" + companyName, new Font(Font.TIMES_ROMAN, 14, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Re:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD))); cell.add(new Phrase("\t\t" + jobName, new Font(Font.TIMES_ROMAN, 14, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Enclosed:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD))); cell.add(new Phrase("\t\t" + title + " Agreement", new Font(Font.TIMES_ROMAN, 14, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); //add Instructions table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); cell = new Cell(); cell.setVerticalAlignment("middle"); cell.add(new Phrase( "In order to finalize your agreement with " + shortName + ", please complete all items as outlined below. " + " It is essential to be finalized no later than ", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.add(new Phrase(agreementDate + ". ", new Font(Font.TIMES_ROMAN, 12, Font.BOLDITALIC))); cell.setBorder(0); table1.addCell(cell); //p1 = new Phrase("Subcontractor Change Order Overview Report", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)); cell = new Cell(); cell.setVerticalAlignment("middle"); cell.add(new Phrase( "A subcontract is considered finalized and ready to activate when all of the attached items outlined below " + "are completed, signed, and returned to " + shortName + ". Do not make any changes directly to the contract documents." + " Any alterations or amendments must be negotiated and mutually agreed upon in advance. If necessary, a new, " + "updated contract will be sent. Contract negotiations are best in person and can be accomplished following the pre-" + "construction conference.", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); //add "Checklist:" table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); cell = new Cell(); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Checklist: ", new Font(Font.TIMES_ROMAN, 12, Font.BOLD))); cell.setBorder(0); table1.addCell(cell); document.add(table1); //add "Business Information" table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("top"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase("Business Information", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.add(new Phrase(" (* indicates required information)", new Font(Font.TIMES_ROMAN, 12, Font.ITALIC))); cell.add(new Phrase("\n * Business Telephone Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\n Primary Contact Name", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\n Business Fax Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\n Mobile Telephone Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\n Email Address", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\n * Federal ID # or Social Security Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); if (insure) { cell.add(new Phrase("\n * Contractor's License Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\n * Attach copy of current contractor's license", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); } cell.setBorder(0); table1.addCell(cell); document.add(table1); //add "Sign and Date the Agreement" table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase("Sign and date the agreement", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); //add "initial all pages" table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase("Initial front page where indicated", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); //add "provide signatures" table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase("Provide appropriate signatures at Exhibit \"C\", Item #2", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); //add "complete and sign exhibit d" if (insure) { table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase("Complete and sign Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); //add "Forward" table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase( "Forward the required insurance certificates (per article 7 and Exhibit \"C\") to " + shortName, new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); } //add "return all pages" table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidths(two); cell = new Cell(checkboxPhrase); cell.setBorderWidth(0); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setVerticalAlignment("bottom"); cell.add(new Phrase("Return all pages of both completed copies of your " + title + " agreement. Do not remove any pages.", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); }
From source file:com.sinkluge.reports.contracts.GenSubcontract.java
public void create(Info in, Image toplogo) throws Exception { //for the unchecked box Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg"); Chunk ch2 = new Chunk(checkbox, -7, -7); Phrase checkboxPhrase = new Phrase(); checkboxPhrase.add(ch2);// ww w .j ava 2s .c o m Font tnr8 = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL); Image iBox = Image.getInstance(in.path + "/WEB-INF/images/initialsBox.jpg");//(in.path + "/jsp/dev/images/epcologo3.jpg"); Chunk ch3 = new Chunk(iBox, -3, -3); Phrase initialsBoxPhrase = new Phrase(); initialsBoxPhrase.add(ch3); Phrase footerPhrase = new Phrase( attr.get("full_name") + ", " + attr.get("address") + ", " + attr.get("city") + ", " + attr.get("state") + " " + attr.get("zip") + "\nPhone: " + attr.get("phone") + " Fax: " + attr.get("fax") + " " + attr.get("url") + " Page: ", new Font(Font.TIMES_ROMAN, 7, Font.BOLD | Font.ITALIC)); HeaderFooter footer = new HeaderFooter(footerPhrase, true); footer.setBorder(0); footer.setAlignment(Element.ALIGN_CENTER); init(40, 40, 40, 40, footer); Phrase underLinePhrase = new Phrase( " ___________________________________________________________________________________________ ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)); int[] twoC = { 30, 70 }; int[] twoD = { 5, 95 }; int[] twoF = { 10, 90 }; int[] twoE = { 25, 75 }; int[] twoG = { 40, 60 }; int[] threeD = { 4, 11, 85 }; int[] threeB = { 70, 15, 15 }; //int[] threeC = { 47, 5, 48 }; int[] five = { 18, 25, 14, 18, 25 }; //blank spacer for keeping tables apart Table spacer = new Table(1, 1); spacer.setBorderWidth(0); //spacer.setDefaultCellBorderWidth(0); spacer.setWidth(100); spacer.setPadding(0); spacer.setSpacing(0); Cell blank = new Cell(); blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD, new Color(255, 255, 255)))); blank.setBorderWidth(0); //blank.setLeading(0); spacer.addCell(blank); //start of document //document.setFooter(footer); //document.setFooter(footer); //add image Phrase p1 = new Phrase(); Table table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(2); table1.setSpacing(2); toplogo.scalePercent(20); //Chunk ch1=new Chunk(toplogo, -36, -55); //p1.add(ch1); Cell cell = new Cell(toplogo); cell.setBorderWidth(0); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); table1.addCell(cell); document.add(table1); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); document.add(spacer); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setLeading(19); cell.add( new Phrase(title.toUpperCase() + " AGREEMENT BETWEEN CONTRACTOR AND " + cTitle.toUpperCase() + "\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setUseDescender(true); cell.setBackgroundColor(Color.lightGray); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setSpacing(0); cell = new Cell(); cell.add(underLinePhrase); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("\nDOCUMENTS CONTAINED HEREIN:\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(3, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setWidths(threeD); table1.setPadding(0); table1.setSpacing(0); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Page 1", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Agreement Declaration", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.add(new Phrase(" Initial boxes below to indicate complete review of this agreement.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Page 2", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Articles of " + title + " Agreement and Standard Provisions", tnr8)); cell.add(new Phrase(" Sign the concluding page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Exhibit \"A\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("List of Contract Documents, Plans, Specifications, Etc.", tnr8)); cell.setBorder(0); //cell.add(new Phrase(" Read and initial each page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC))); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Exhibit \"B\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle + "'s Scope of Work", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Exhibit \"C\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle + "'s Special Provisions and Procedure Requirements", tnr8)); cell.add(new Phrase(" Read and complete \"Release Authorization\" information.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); if (insure) { cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle + " Cost Breakdown", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.add(new Phrase(" Complete and return with signed contract", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); } cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setColspan(2); cell.add(new Phrase("NOTE OTHERS HERE:", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(3); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(threeB); table1.addCell(blank); cell = new Cell(); cell.setColspan(2); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("(Initial) Entire agreement thoroughly reviewed:\n", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Contractor: ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle + ": ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setColspan(3); cell.add(underLinePhrase); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("AGREEMENT", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" made as of " + agreementDate, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("BETWEEN", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the Contractor: \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + attr.get("full_name") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + attr.get("address") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + attr.get("city") + ", " + attr.get("state") + " " + attr.get("zip"), new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" (hereinafter known as \"Contractor\")\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("AND", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the " + cTitle + ": \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + subName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + subAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + subCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" (hereinafter known as \"" + cTitle + "\")\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the the fixed sum of " + DocHelper.numberAndText(amount) + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); //cell.add(new Phrase(" " + amountString + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the Project known as:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + projectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + projectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + projectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" (hereinafter known as \"Project\")\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("BY", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the Architect:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + architectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + architectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + architectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" (hereinafter known as \"Architect\")\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the Project owner:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + ownerName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + ownerAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" " + ownerCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase(" (hereinafter known as \"Owner\")\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("WHEREFORE", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.add(new Phrase(" the Contractor and " + cTitle + " agree as follows:\n\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); /* table1 = new Table(1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); //cell.add(new Phrase("\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); cell.setBorder(Rectangle.BOTTOM | Rectangle.TOP); cell.setBorderWidth(1.1f); cell.add(footerPhrase); cell.add(new Phrase(" 1\n ", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL))); //cell.add(footerPhrase2); cell.setBorder(0); table1.addCell(cell); document.add(table1); */ document.newPage(); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(title.toUpperCase() + " AGREEMENT\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setBackgroundColor(Color.lightGray); cell.setLeading(19); cell.setUseDescender(true); cell.setBorder(0); table1.addCell(cell); document.add(table1); Paragraph para = new Paragraph(8, "\n\n" + text.toString(), tnr8); document.add(para); Phrase p; document.add(spacer); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setWidths(twoC); table1.setPadding(0); p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); p = new Phrase("_________________________________________________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(" General Contractor Title\n", tnr8)); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setColspan(2); cell.add(new Phrase("\nThis " + title + " Agreement supercedes all other proposals, documents, and negotiations whether written or verbal\n\n", new Font(Font.TIMES_ROMAN, 8, Font.BOLDITALIC))); cell.setBorder(0); table1.addCell(cell); p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); p = new Phrase("_________________________________________________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(p); cell.setBorder(0); table1.addCell(cell); table1.addCell(blank); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase( " " + cTitle + " Title\n", tnr8)); cell.setBorder(0); table1.addCell(cell); table1.setCellsFitPage(true); table1.setTableFitsPage(true); document.add(table1); document.newPage(); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle.toUpperCase() + " INFORMATION\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setBackgroundColor(Color.lightGray); cell.setLeading(19); cell.setUseDescender(true); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(new Phrase("\n")); table1 = new Table(5, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(1); table1.setWidths(five); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Federal I.D. : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.add(new Phrase(federal_id, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("(Both Required)", new Font(Font.TIMES_ROMAN, 8, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("License Number : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.add(new Phrase(license_number, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Contact : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.setUseDescender(true); cell.add(new Phrase(contactName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Company : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Telephone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.setUseDescender(true); cell.add(new Phrase(telephone, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Fax : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.add(new Phrase(fax, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Mobile phone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.add(new Phrase(mobile, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("E-mail : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.setBorder(15); cell.add(new Phrase(email, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); table1.addCell(cell); document.add(table1); //document.add(spacer); table1 = new Table(1, 1); //table1.setBorderWidth(4); //table1.setBorderColor(Color.lightGray); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setBorder(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); if (insure) cell.add(new Phrase("Please attach a COPY of your current state license to this page:", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); else cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); if (insure) cell.add(new Phrase("\n\nAttach\nCopy of\nContractor's\nLicense\nHere\n(If Applicable)", new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray))); else cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray))); cell.setBorder(0); table1.addCell(cell); document.add(table1); //document.setMargins(72, 72, 36, 36); document.newPage(); table1 = new Table(1, 1); table1.setOffset(0); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidth(100); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"A\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setLeading(6); cell.setBorder(0); table1.addCell(cell); cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("CONTRACT DOCUMENTS, PLANS,\nSPECIFICATIONS, ADDENDUMS, ETC.\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD))); cell.setUseDescender(true); cell.setLeading(17); cell.setBackgroundColor(Color.lightGray); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("\n" + subName + " is responsible to verify versions, dates, and completeness of documents that were used in the preparation of the " + cTitle + "'s bid proposal before signing this " + title + " Agreement\n", tnr8)); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("This " + title + " Agreement includes, but is not limited to the following items:", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setUseDescender(true); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidth(0.5f); table1.addCell(cell); document.add(table1); Paragraph prgh = new Paragraph("\n" + bidDocuments + "\n", tnr8); prgh.setLeading(10); document.add(prgh); document.add(spacer); /* p = new Phrase("\n"+bidDocuments, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); p.setLeading(10); cell= new Cell(p); cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM); cell.setBorderWidth(0.5f); //cell.setBorderColor(Color.lightGray); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.setUseDescender(true); table1.addCell(cell); */ table1 = new Table(1, 1); table1.setOffset(0); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setWidth(100); table1.setTableFitsPage(true); p = new Phrase("\nPlease note below all verbal conditions or instructions, if any, that the " + cTitle + " has received during the bid process which might affect the scope of work as required by the contract documents", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); p.setLeading(10); cell = new Cell(p); cell.setBorder(Rectangle.TOP); cell.setBorderWidth(0.5f); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); table1.addCell(cell); document.add(table1); document.newPage(); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setOffset(0); table1.setWidth(100); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"B\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setLeading(6); cell.setBorder(0); table1.addCell(cell); cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("SCOPE OF WORK\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD))); cell.setBackgroundColor(Color.lightGray); cell.setUseDescender(true); cell.setLeading(17); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase( "\nThis " + title + " Agreement includes, but is not limited to the following items:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidth(0.5f); table1.addCell(cell); document.add(table1); prgh = new Paragraph("\n" + contractDescription + "\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)); prgh.setLeading(10); document.add(prgh); //cell= new Cell(prgh); //cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM); //cell.setBorderWidth(0.5f); //cell.setBorderColor(Color.lightGray); //cell.setHorizontalAlignment("left"); //cell.setVerticalAlignment("middle"); //cell.setLeading(10); //cell.setUseDescender(true); //table1.addCell(cell); document.add(spacer); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setOffset(0); table1.setWidth(100); table1.setTableFitsPage(true); p = new Phrase("\nAll " + cTitle + " bid proposal conditions that are outside of, in addition to or are limiting of conditions contained in the Contract Documents are of no effect and are invalid to the " + title + " Agreement unless expressly included in the description above.", tnr8); p.setLeading(10); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setBorder(Rectangle.TOP); cell.setBorderWidth(0.5f); table1.addCell(cell); document.add(table1); //document.setMargins(10, 10, 30, 30); document.newPage(); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setOffset(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"C\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setLeading(6); cell.setBorder(0); cell.setBorder(0); table1.addCell(cell); cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle.toUpperCase() + " SPECIAL PROVISIONS AND REQUIREMENTS\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD))); cell.setBackgroundColor(Color.lightGray); cell.setUseDescender(true); cell.setLeading(17); cell.setBorder(0); table1.addCell(cell); document.add(table1); int count = 1; if (insure) { table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(4); cell = new Cell(); cell.add(new Phrase("1. Insurance Provisions (If Applicable)", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); //cell.setLeading(6); cell.setBorder(0); table1.addCell(cell); document.add(table1); count++; table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(twoD); table1.setOffset(0); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setLeading(6); cell.add(new Phrase( "a. The " + cTitle + " is required to name the following as additional Primary-Insured:", tnr8)); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(twoE); table1.setOffset(0); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Contractor: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(attr.get("full_name"), new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Owner: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(ownerName, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("Other: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase("_______________________________________", tnr8)); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(twoD); table1.setOffset(4); p = new Phrase("b. The " + cTitle + " must provide verification of current Worker's Compensation coverage with reference to " + jobName + " on the policy.", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)); p.setLeading(8); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setLeading(8); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); } table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(4); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(count + ". Release Authorizations", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); count++; cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setOffset(4); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(twoD); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); p = new Phrase( "List any Owners, Partners, and/or Corporate Officers who are legally authorized to sign for " + subName + " and who will be signing the MONTHLY REQUEST FOR PAYMENT, FINAL REQUEST FOR PAYMENT, and LIEN WAIVER documents:\n\n", tnr8); p.setLeading(8); p1 = new Phrase( " ______________________________________________________________________ ______________________________________________________________________\n", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)); //p1.setLeading(0); Phrase p2 = new Phrase( " Printed name and title Signature\n\n", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)); //cell.setLeading(8); cell.add(p); cell.add(p1); cell.add(p2); cell.add(p1); cell.add(p2); cell.add(p1); cell.add(p2); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setOffset(0); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(count + ". Shop Drawings - Samples - Submittals", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.setBorder(0); table1.addCell(cell); document.add(table1); count++; table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(twoD); table1.setOffset(2); p = new Phrase( "All shop drawings, materials samples, and submittals shall be submitted to the Contractor within 30 days of the issuance of this " + title + " Agreement unless specifically noted below. All submitted items shall be in number and type as per the contract documents including, but not limited to, the following:", tnr8); p.setLeading(8); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setWidths(twoF); table1.setOffset(4); p = new Phrase("--The number of copies of each submittal for " + jobName + " is " + submittal_copies + ".\n--All submittals, of any type, are due on or before " + dueDate + " unless specifically noted otherwise.\n", tnr8); p.setLeading(8); cell = new Cell(p); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); String submittals = ""; if (!submittalVector.isEmpty()) { p = new Phrase(" Due Date:\n", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)); p.setLeading(8); cell = new Cell(p); cell.setColspan(2); cell.setBorder(0); table1.addCell(cell); for (int i = 0; i < submittalVector.size(); i++) { submittals += (String) submittalVector.elementAt(i) + "\n"; } p = new Phrase(submittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)); p.setLeading(8); cell = new Cell(p); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); } else { p = new Phrase("\nSubmittals required per contract documents and specifications.\n", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)); p.setLeading(8); cell = new Cell(p); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); } p = new Phrase("\n(" + subName + " is responsible for all submittals required in the Contract Documents as pertaining to labor and materials included in the scope of this " + title + " Agreement regardless of items listed, not listed, or incorrectly listed above.)", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)); p.setLeading(8); cell = new Cell(p); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(1); table1.setWidths(twoD); table1.setOffset(2); p = new Phrase(cTitle.toUpperCase() + " acknowledges that review and approval of any type of submittal which deviates from the Project Plans and Specifications does NOT relieve the " + cTitle + " from costs, penalties and all other remedies required to meet the published specifications where the " + cTitle + " failed to notify the Owner/Architect/Contractor in writing of the variations from the specifications and failed to obtain written approval for EACH variation from the published specifications.", tnr8); p.setLeading(8); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(8); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(2); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(count + ". Project Close-out", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.setBorder(0); table1.addCell(cell); document.add(table1); count++; table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(4); table1.setWidths(twoD); p = new Phrase( "All project close-out documents, materials, and Owner-training required by the Contract Documents shall be submitted to the Contractor PRIOR to payment of the " + cTitle + "'s 90% completion payment request. The requirements shall include, but not be limited to, the following:", tnr8); p.setLeading(8); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(8); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(0); table1.setWidths(twoG); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("top"); cell.add(new Phrase("\"O & M\" Submittals: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("top"); cell.add(new Phrase(omSubmittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("top"); cell.add(new Phrase("Full Warranty: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("top"); cell.add(new Phrase(fullWarranty, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("top"); cell.add(new Phrase("Up-to-date Lien Release(s): ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("top"); cell.add(new Phrase(lienReleases, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("top"); cell.add(new Phrase("Signed Training Form: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("top"); cell.add(new Phrase(signedTraining, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("top"); cell.add(new Phrase("Materials-Equip-Specialty Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("top"); cell.add(new Phrase(specialtyItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("right"); cell.setVerticalAlignment("top"); cell.add(new Phrase("Other Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("top"); cell.add(new Phrase(otherItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL))); cell.setBorder(0); table1.addCell(cell); document.add(table1); if (insure) { table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setOffset(2); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(count + ". " + cTitle + " Safety Program (If Applicable)", new Font(Font.TIMES_ROMAN, 10, Font.BOLD))); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(2, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(2); table1.setWidths(twoD); p = new Phrase( cTitle + " will submit one copy of the " + cTitle + "'s job-specific safety program to " + attr.get("full_name") + " before any equipment, manpower, or materials are brought onto the Project site. ", tnr8); p.setLeading(8); cell = new Cell(p); p = new Phrase(cTitle + " will require it's " + cTitle.toLowerCase() + "s to have in place a job-specific safety program before they enter the Project site.", tnr8); p.setLeading(8); cell.add(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); //cell.setLeading(8); table1.addCell(blank); cell.setBorder(0); table1.addCell(cell); document.add(table1); } if (insure) { document.newPage(); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(3); table1.setOffset(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"D\"", new Font(Font.TIMES_ROMAN, 20, Font.BOLD))); cell.setLeading(6); cell.setBorder(0); table1.addCell(cell); cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8))); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); cell.add(new Phrase(cTitle.toUpperCase() + "'S COST BREAKDOWN\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD))); cell.setBackgroundColor(Color.lightGray); cell.setUseDescender(true); cell.setLeading(17); cell.setBorder(0); table1.addCell(cell); document.add(table1); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setPadding(0); table1.setOffset(2); p = new Phrase("The following information is to be supplied by " + subName + " for " + jobName + ". List all SUPPLIERS and SUBCONTRACTORS for approval and payment confirmation (attach additional pages if needed):", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); p.setLeading(12); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase( " Name City Phone Estimated Dollar Amount", tnr8)); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); p = new Phrase( "________________________________________________________________________ $___________________\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); for (int i = 0; i < 10; i++) { cell.add(p); } cell.setBorder(0); table1.addCell(cell); p = new Phrase( "Supplier accepts full responsibility for acts and omissions of his subcontractors and suppliers. No suppliers or subcontractors are to be added or deleted without prior notification to " + attr.get("full_name") + ".", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)); p.setLeading(10); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setLeading(15); cell.setBorder(0); table1.addCell(cell); p = new Phrase( "List the primary phases of your contracted scope of work and the associated costs. This information may be released to the Owner if disputes arise over future billings and progress payments.", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); p.setLeading(12); cell = new Cell(p); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.setLeading(15); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); cell.add(new Phrase( "Description/Phase of Work Labor Material Equipment/Tools Sub-subcontractor Total", tnr8)); cell.setBorder(0); table1.addCell(cell); cell = new Cell(); p = new Phrase( "________________________ $____________ $____________ $____________ $____________ $____________ \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)); cell.setHorizontalAlignment("left"); cell.setVerticalAlignment("middle"); for (int i = 0; i < 13; i++) { cell.add(p); } cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setOffset(2); table1.setPadding(1); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.UNDERLINE))); cell.add(new Phrase("\n" + cTitle, new Font(Font.TIMES_ROMAN, 6, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); document.add(spacer); table1 = new Table(1, 1); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); table1.setOffset(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\nPrint Name of Authorized Company Officer", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); document.add(table1); document.add(spacer); document.add(spacer); table1 = new Table(1, 1); table1.setOffset(0); table1.setBorderWidth(0); table1.setWidth(100); //table1.setDefaultCellBorder(0); cell = new Cell(); cell.setHorizontalAlignment("center"); cell.setVerticalAlignment("middle"); //cell.setLeading(10); cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL))); cell.add(new Phrase("\nAuthorized Signature", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC))); cell.setBorder(0); table1.addCell(cell); document.add(table1); } }
From source file:de.ipbhalle.metfrag.tools.renderer.WritePDFTable.java
License:Open Source License
/** * Instantiates a new write pdf table. This is mainly for debugging the gasteiger marsili charges * //from ww w . j a v a 2 s. c om * @param odir the odir * @param width the width * @param height the height * @param chargeResults the charge results */ public WritePDFTable(String odir, int width, int height, List<ChargeResult> chargeResults) { this.width = width; this.height = height; try { File file = new File(odir); document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file)); float[] widths = new float[ncol]; for (int i = 0; i < ncol; i += 3) { widths[i] = 2.5f; widths[i + 1] = 0.75f; widths[i + 2] = 0.75f; } table = new PdfPTable(widths); document.open(); boolean drawPartialCharges = true; for (ChargeResult result : chargeResults) { if (drawPartialCharges) { PdfPCell cellBonds = new PdfPCell(); PdfPCell cellBondsDist = new PdfPCell(); Phrase phraseBonds = new Phrase(); Phrase phraseBondsDist = new Phrase(); com.lowagie.text.Image image = com.lowagie.text.Image .getInstance(writeMOL2PNGFile(result.getOriginalMol()).getAbsolutePath()); image.setAbsolutePosition(0, 0); table.addCell(image); String stringAtoms = ""; String stringAtomsCharge = ""; for (IAtom atom : result.getOriginalMol().atoms()) { if (!atom.getSymbol().equals("H") && !atom.getSymbol().equals("C")) { stringAtoms += atom.getSymbol() + (Integer.parseInt(atom.getID()) + 1) + "\n"; stringAtomsCharge += Math.round(atom.getCharge() * 100.0) / 100.0 + "\n"; } } addProperty(phraseBonds, stringAtoms); addProperty(phraseBondsDist, stringAtomsCharge); cellBonds.addElement(phraseBonds); cellBondsDist.addElement(phraseBondsDist); table.addCell(cellBonds); table.addCell(cellBondsDist); drawPartialCharges = false; } PdfPCell cellBonds = new PdfPCell(); PdfPCell cellBondsDist = new PdfPCell(); Phrase phraseBonds = new Phrase(); Phrase phraseBondsDist = new Phrase(); com.lowagie.text.Image image = com.lowagie.text.Image.getInstance( writeMOL2PNGFile(result.getOriginalMol(), result.getMolWithProton()).getAbsolutePath()); image.setAbsolutePosition(0, 0); table.addCell(image); String stringPDFBonds = ""; String stringPDFBondsDist = ""; String[] lines = result.getChargeString().split("\n"); for (int i = 0; i < lines.length; i++) { boolean carbonHydrogenBond = lines[i].matches("[A-Z]+[0-9]+-H[0-9]+.*"); if (!carbonHydrogenBond) { String[] linesArr = lines[i].split("\t"); stringPDFBondsDist += linesArr[1] + "\n"; stringPDFBonds += linesArr[0] + "\n"; } } addProperty(phraseBonds, stringPDFBonds); addProperty(phraseBondsDist, stringPDFBondsDist); cellBonds.addElement(phraseBonds); cellBondsDist.addElement(phraseBondsDist); table.addCell(cellBonds); table.addCell(cellBondsDist); } document.add(table); document.close(); } catch (Exception exc) { exc.printStackTrace(); } }
From source file:de.tr1.cooperator.manager.web.CreateSubscriberListActionHelper.java
License:Open Source License
/** * The first thing to do when the document is opened, is to define the BaseFont, * get the Direct Content object and create the template that will hold the final * number of pages.//w ww . ja va 2s . c om * @see com.lowagie.text.pdf.PdfPageEventHelper#onOpenDocument(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document) */ public void onOpenDocument(PdfWriter writer, Document document) { try { bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb = writer.getDirectContent(); // initialization of the header table tHeader = new PdfPTable(2); Phrase p = new Phrase(); tHeader.getDefaultCell().setBorder(Rectangle.NO_BORDER); tHeader.addCell(sHeaderLeft); tHeader.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); tHeader.addCell(sHeaderRight); template = cb.createTemplate(50, 50); } catch (DocumentException de) { } catch (IOException ioe) { } }
From source file:fr.aliasource.webmail.server.export.ConversationPdfEventHandler.java
License:GNU General Public License
/** * @see com.lowagie.text.pdf.PdfPageEventHelper#onOpenDocument(com.lowagie.text.pdf.PdfWriter, * com.lowagie.text.Document)//from www . j a v a 2 s . c o m */ public void onOpenDocument(PdfWriter writer, Document document) { try { headerImage = Image.getInstance(getLogoUrl()); table = new PdfPTable(new float[] { 1f, 2f }); Phrase p = new Phrase(); Chunk ck = new Chunk(cr.getTitle(), new Font(Font.HELVETICA, 16, Font.BOLD)); p.add(ck); p.add(Chunk.NEWLINE); ck = new Chunk(ConversationExporter.formatName(account), new Font(Font.HELVETICA, 12, Font.BOLDITALIC)); p.add(ck); p.add(Chunk.NEWLINE); ck = new Chunk(cm.length + " messages", new Font(Font.HELVETICA, 10)); p.add(ck); table.getDefaultCell().setBorder(0); table.addCell(new Phrase(new Chunk(headerImage, 0, 0))); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(p); // initialization of the template tpl = writer.getDirectContent().createTemplate(100, 100); tpl.setBoundingBox(new Rectangle(-20, -20, 100, 100)); // initialization of the font helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false); } catch (Exception e) { throw new ExceptionConverter(e); } }
From source file:fr.paris.lutece.plugins.directory.modules.pdfproducer.utils.PDFUtils.java
License:Open Source License
/** * This method build the different label and value of directory fields in * the document PDF/*from w ww . ja v a 2 s . c o m*/ * * @param listRecordFields recordfield map * @param document document pdf * @param entry entry * @param locale the locale * @param bExtractNotFilledField if true, extract empty fields, false * @throws DocumentException DocumentException */ private static void builFieldsInPDF(List<RecordField> listRecordFields, Document document, IEntry entry, Locale locale, Boolean bExtractNotFilledField) throws DocumentException { Phrase phraseEntry = new Phrase(); Paragraph paragraphEntry = new Paragraph(); if (StringUtils.isNotBlank(entry.getTitle())) { entry.getTitle(); Font fontEntryTitle = new Font( DirectoryUtils.convertStringToInt(AppPropertiesService.getProperty(PROPERTY_POLICE_NAME)), DirectoryUtils .convertStringToInt(AppPropertiesService.getProperty(PROPERTY_POLICE_SIZE_ENTRY_TITLE)), DirectoryUtils.convertStringToInt( AppPropertiesService.getProperty(PROPERTY_POLICE_STYLE_ENTRY_TITLE))); Chunk chunkEntryTitle = new Chunk(entry.getTitle(), fontEntryTitle); phraseEntry.add(chunkEntryTitle); phraseEntry.add(" : "); } if ((listRecordFields != null) && (listRecordFields.size() > 0)) { // Must separate the behaviour whether the list of record fiels contains 1 or more record fields if ((listRecordFields.size() > 1) && !(entry instanceof fr.paris.lutece.plugins.directory.business.EntryTypeGeolocation)) { builFieldsInParagraph(listRecordFields, entry, locale, phraseEntry, paragraphEntry, bExtractNotFilledField); } else { builFieldsInSinglePhrase(listRecordFields, entry, locale, phraseEntry, paragraphEntry, bExtractNotFilledField); } } document.add(paragraphEntry); }
From source file:ispyb.client.mx.results.ExportAutoProcAction.java
License:Open Source License
private void setAutoProcInfo(Document document) throws Exception { // header//from w w w . j ava 2 s. c om Table headerTable = new Table(1); headerTable.getDefaultCell().setBorderWidth(0); headerTable.setBorderWidth(0); headerTable.setCellsFitPage(true); headerTable.setAlignment(Element.ALIGN_LEFT); headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); headerTable.getDefaultCell().setBackgroundColor(PdfRtfExporter.LIGHT_YELLOW_COLOR); headerTable.getDefaultCell().setLeading(3); headerTable.setWidth(100); // percentage headerTable .addCell(new Paragraph("Crystal data and data-collection statistics", PdfRtfExporter.FONT_DOC_11)); headerTable.addCell(new Paragraph("Values in parentheses are for the highest resolution shell.", PdfRtfExporter.FONT_DOC_11)); document.add(headerTable); document.add(new Paragraph(" ", PdfRtfExporter.VERY_SMALL_FONT)); // auto proc table Table autoProcTable = new Table(2); autoProcTable.getDefaultCell().setBorderWidth(0); autoProcTable.setBorderWidth(0); autoProcTable.setCellsFitPage(true); autoProcTable.setAlignment(Element.ALIGN_LEFT); autoProcTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // autoProcTable.getDefaultCell().setLeading(3); autoProcTable.setPadding(2); autoProcTable.setWidth(100); // percentage // data String spaceGroup = autoProc == null ? "" : autoProc.getSpaceGroup(); String unitCell_a = autoProc == null ? "" : autoProc.getRefinedCellA().toString(); String unitCell_b = autoProc == null ? "" : autoProc.getRefinedCellB().toString(); String unitCell_c = autoProc == null ? "" : autoProc.getRefinedCellC().toString(); String unitCell_alpha = autoProc == null ? "" : autoProc.getRefinedCellAlpha().toString(); String unitCell_beta = autoProc == null ? "" : autoProc.getRefinedCellBeta().toString(); String unitCell_gamma = autoProc == null ? "" : autoProc.getRefinedCellGamma().toString(); String resolutionRange = ""; String nTotalObservations = ""; String nTotalUniqueReflections = ""; String completeness = ""; String multiplicity = ""; String isigma = ""; String rmerge = ""; if (autoProcStatisticsOverall != null) { resolutionRange = autoProcStatisticsOverall.getResolutionLimitLow() + " - " + autoProcStatisticsOverall.getResolutionLimitHigh(); nTotalObservations = "" + autoProcStatisticsOverall.getnTotalObservations(); nTotalUniqueReflections = "" + (autoProcStatisticsOverall.getnTotalUniqueObservations() == null ? "" : autoProcStatisticsOverall.getnTotalUniqueObservations()); completeness = "" + autoProcStatisticsOverall.getCompleteness(); multiplicity = "" + autoProcStatisticsOverall.getMultiplicity(); isigma = "" + autoProcStatisticsOverall.getMeanIoverSigI(); rmerge = "" + (autoProcStatisticsOverall.getRmerge() == null ? "" : autoProcStatisticsOverall.getRmerge()); } if (autoProcStatisticsOuter != null) { resolutionRange += " (" + autoProcStatisticsOuter.getResolutionLimitLow() + " - " + autoProcStatisticsOuter.getResolutionLimitHigh() + ")"; nTotalObservations += " (" + autoProcStatisticsOuter.getnTotalObservations() + ")"; nTotalUniqueReflections += autoProcStatisticsOuter.getnTotalUniqueObservations() == null ? "" : (" (" + autoProcStatisticsOuter.getnTotalUniqueObservations() + ")"); completeness += " (" + autoProcStatisticsOuter.getCompleteness() + ")"; multiplicity += " (" + autoProcStatisticsOuter.getMultiplicity() + ")"; isigma += " (" + autoProcStatisticsOuter.getMeanIoverSigI() + ")"; rmerge += " (" + (autoProcStatisticsOuter.getRmerge() == null ? "" : autoProcStatisticsOuter.getRmerge()) + ")"; } // space group autoProcTable.addCell(new Paragraph("Space Group", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(spaceGroup, PdfRtfExporter.FONT_DOC_11)); // unit cell parameters autoProcTable.addCell( new Paragraph("Unit-cell parameters (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph("", PdfRtfExporter.FONT_DOC_11)); Paragraph pa = new Paragraph("\t a", PdfRtfExporter.FONT_DOC_11); pa.setAlignment(Element.ALIGN_JUSTIFIED); pa.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pa); autoProcTable.addCell(new Paragraph(unitCell_a, PdfRtfExporter.FONT_DOC_11)); Paragraph pb = new Paragraph("\t b", PdfRtfExporter.FONT_DOC_11); pb.setAlignment(Element.ALIGN_JUSTIFIED); pb.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pb); autoProcTable.addCell(new Paragraph(unitCell_b, PdfRtfExporter.FONT_DOC_11)); Paragraph pc = new Paragraph("\t c", PdfRtfExporter.FONT_DOC_11); pc.setAlignment(Element.ALIGN_JUSTIFIED); pc.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pc); autoProcTable.addCell(new Paragraph(unitCell_c, PdfRtfExporter.FONT_DOC_11)); // Issue 1733: cell angles info added Paragraph palpha = new Paragraph("\t alpha", PdfRtfExporter.FONT_DOC_11); palpha.setAlignment(Element.ALIGN_JUSTIFIED); palpha.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(palpha); autoProcTable.addCell(new Paragraph(unitCell_alpha, PdfRtfExporter.FONT_DOC_11)); Paragraph pbeta = new Paragraph("\t beta", PdfRtfExporter.FONT_DOC_11); pbeta.setAlignment(Element.ALIGN_JUSTIFIED); pbeta.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pbeta); autoProcTable.addCell(new Paragraph(unitCell_beta, PdfRtfExporter.FONT_DOC_11)); Paragraph pgamma = new Paragraph("\t gamma", PdfRtfExporter.FONT_DOC_11); pgamma.setAlignment(Element.ALIGN_JUSTIFIED); pgamma.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pgamma); autoProcTable.addCell(new Paragraph(unitCell_gamma, PdfRtfExporter.FONT_DOC_11)); // resolution range autoProcTable.addCell( new Paragraph("Resolution range (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(resolutionRange, PdfRtfExporter.FONT_DOC_11)); // Observed reflections autoProcTable.addCell(new Paragraph("Observed reflections", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(nTotalObservations, PdfRtfExporter.FONT_DOC_11)); // No. of unique reflections autoProcTable.addCell(new Paragraph("No. of unique reflections", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(nTotalUniqueReflections, PdfRtfExporter.FONT_DOC_11)); // Completeness autoProcTable.addCell(new Paragraph("Completeness (%)", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(completeness, PdfRtfExporter.FONT_DOC_11)); // multiplicity autoProcTable.addCell(new Paragraph("Multiplicity", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(multiplicity, PdfRtfExporter.FONT_DOC_11)); new Phrase(); // I/(I) Phrase p = Phrase.getInstance("<I/" + (char) 963 + "(I)>"); p.setFont(PdfRtfExporter.FONT_DOC_11); autoProcTable.addCell(p); autoProcTable.addCell(new Paragraph(isigma, PdfRtfExporter.FONT_DOC_11)); // Rmerge Chunk c1 = new Chunk("R", PdfRtfExporter.FONT_DOC_11); Chunk c2 = new Chunk("merge", PdfRtfExporter.FONT_DOC_EXPONENT); c2.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); Chunk c3 = new Chunk("(%)", PdfRtfExporter.FONT_DOC_11); Chunk c4 = new Chunk("#", PdfRtfExporter.FONT_DOC_EXPONENT_BLUE); c4.setTextRise(PdfRtfExporter.TEXT_RISE_EXP); Paragraph rMergeParagraph = new Paragraph(); rMergeParagraph.add(c1); rMergeParagraph.add(c2); rMergeParagraph.add(c3); rMergeParagraph.add(c4); autoProcTable.addCell(rMergeParagraph); autoProcTable.addCell(new Paragraph(rmerge, PdfRtfExporter.FONT_DOC_11)); document.add(autoProcTable); document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11)); // nota bene info Paragraph nbParagraph = new Paragraph(); nbParagraph.add(c4); nbParagraph.add(c1); nbParagraph.add(c2); Chunk cesp = new Chunk(" ", PdfRtfExporter.FONT_DOC_11); Chunk c5 = new Chunk(" = ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c5); Phrase pSigma = Phrase.getInstance("" + (char) 931); pSigma.setFont(PdfRtfExporter.FONT_DOC_11); nbParagraph.add(pSigma); Chunk chkl = new Chunk("hkl", PdfRtfExporter.FONT_DOC_EXPONENT); chkl.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(chkl); nbParagraph.add(cesp); nbParagraph.add(pSigma); Chunk ci = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT); ci.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(ci); Chunk c8 = new Chunk(" |I", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c8); nbParagraph.add(ci); Chunk c9 = new Chunk("(hkl) - (I(hkl))| / ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c9); nbParagraph.add(pSigma); nbParagraph.add(chkl); nbParagraph.add(cesp); nbParagraph.add(pSigma); nbParagraph.add(ci); nbParagraph.add(cesp); Chunk c10 = new Chunk("I", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c10); nbParagraph.add(ci); Chunk c11 = new Chunk("(hkl), where ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c11); Chunk c12 = new Chunk("I", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c12); Chunk cii = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT_ITALIC); cii.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(cii); Chunk c13 = new Chunk("(hkl)", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c13); Chunk c14 = new Chunk(" is the ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c14); Chunk c15 = new Chunk("i", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c15); Chunk c16 = new Chunk("th observation of reflection ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c16); Chunk chklI = new Chunk("hkl", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(chklI); Chunk c17 = new Chunk(" and ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c17); Chunk c18 = new Chunk("<I(hkl)> ", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c18); Chunk c19 = new Chunk(" is the weighted average intensity for all observations of reflection ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c19); nbParagraph.add(chklI); Chunk c20 = new Chunk(".", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c20); document.add(nbParagraph); document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11)); }
From source file:jdbreport.model.io.pdf.itext2.PdfWriter.java
License:Apache License
protected void writeHTMLText(CellStyle parentStyle, jdbreport.model.Cell cell, PdfPCell pdfCell) { if (cell.isNull() || cell.isChild()) return;//from w w w .j a va 2 s.c o m JTextComponent tc = getHTMLReportRenderer(); tc.setText(cell.getText()); List<Content> contentList = Content.getHTMLContentList((HTMLDocument) tc.getDocument()); if (contentList != null) { Phrase phrase = new Phrase(); for (Content content : contentList) { CellStyle newStyle = content.createTextStyle(parentStyle, parentStyle); if (newStyle == null) { newStyle = parentStyle; } if (newStyle != null) { if (newStyle.getTypeOffset() == CellStyle.SS_SUPER || newStyle.getTypeOffset() == CellStyle.SS_SUB) { newStyle = newStyle.deriveFont((float) newStyle.getSize() / 2); } int i = textStyles.indexOf(newStyle); if (i < 0) { textStyles.add(newStyle); i = textStyles.size() - 1; } Font font; String styleId = "T" + (i + 1); if (fonts.containsKey(styleId)) { font = fonts.get(styleId); } else { font = getFontMapper().styleToPdf(newStyle); fonts.put(styleId, font); } Chunk chunk = new Chunk(content.getText(), font); chunk.setBackground(newStyle.getBackground()); if (newStyle.getTypeOffset() == CellStyle.SS_SUPER) { chunk.setTextRise(newStyle.getSize() / 2); } else if (newStyle.getTypeOffset() == CellStyle.SS_SUB) { chunk.setTextRise(-newStyle.getSize() / 2); } phrase.add(chunk); } else { phrase.add(new Chunk(content.getText())); } } pdfCell.setPhrase(phrase); } }
From source file:mitm.common.pdf.MessagePDFBuilder.java
License:Open Source License
private void addBodyAndAttachments(PdfWriter pdfWriter, Document document, PdfPTable bodyTable, String body, Collection<Part> attachments) throws DocumentException, MessagingException, IOException { /*/* w ww . j a va 2s . c o m*/ * Font for anchors (links) */ Font linkFont = createLinkFont(); FontSelector bodyFontSelector = createBodyFontSelector(); PdfPCell bodyCell = new PdfPCell(); /* * Body table will be white */ bodyCell.setGrayFill(1f); bodyCell.setPadding(10); Phrase bodyPhrase = new Phrase(); bodyCell.setPhrase(bodyPhrase); /* * Matcher we need to convert links to clickable links */ Matcher urlMatcher = urlPattern.matcher(body); String textPart; int currentIndex = 0; /* * Add body and links */ while (urlMatcher.find()) { textPart = body.substring(currentIndex, urlMatcher.start()); addTextPart(textPart, bodyPhrase, bodyFontSelector); String linkPart = urlMatcher.group(); if (linkPart != null) { addLinkPart(linkPart, bodyPhrase, linkFont); currentIndex = urlMatcher.start() + linkPart.length(); } } textPart = body.substring(currentIndex); addTextPart(textPart, bodyPhrase, bodyFontSelector); bodyTable.addCell(bodyCell); document.add(bodyTable); addAttachments(pdfWriter, attachments); }