List of usage examples for com.itextpdf.text BaseColor LIGHT_GRAY
BaseColor LIGHT_GRAY
To view the source code for com.itextpdf.text BaseColor LIGHT_GRAY.
Click Source Link
From source file:com.docdoku.server.extras.TitleBlockGenerator.java
License:Open Source License
private void generateLyfeCycleState(Paragraph preface, ResourceBundle bundle) { // Table title preface.add(new Paragraph(bundle.getString("lifecycle") + " : " + lifeCycleState, BOLD_12)); addEmptyLine(preface, 1);/*from w w w .ja v a 2 s.com*/ PdfPTable lifeCycleTable = new PdfPTable(5); lifeCycleTable.setWidthPercentage(100f); PdfPCell cell; for (Activity activity : workflow.getActivities()) { boolean headerRendered = false; for (Task task : activity.getTasks()) { if (task.isApproved() || task.isRejected()) { if (!headerRendered) { // Table head cell = new PdfPCell(new Phrase(activity.getLifeCycleState(), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setColspan(5); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.task"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.date"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.author"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.comments"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.signature"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); headerRendered = true; } // Table body cell = new PdfPCell(new Phrase(task.getTitle(), NORMAL_12)); lifeCycleTable.addCell(cell); SimpleDateFormat simpleFormat = new SimpleDateFormat(bundle.getString("date.format")); cell = new PdfPCell(new Phrase(simpleFormat.format(task.getClosureDate()), NORMAL_12)); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(task.getWorker().getName(), NORMAL_12)); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(task.getClosureComment(), NORMAL_12)); lifeCycleTable.addCell(cell); if (task.getSignature() != null) { try { byte[] imageByte; int indexOfFirstComma = task.getSignature().indexOf(","); String base64 = task.getSignature().substring(indexOfFirstComma + 1, task.getSignature().length()); imageByte = DatatypeConverter.parseBase64Binary(base64); Image image = Image.getInstance(imageByte); image.setCompressionLevel(Image.ORIGINAL_NONE); image.scaleToFit(SIGNATURE_SIZE_W, SIGNATURE_SIZE_H); cell = new PdfPCell(image); lifeCycleTable.addCell(cell); } catch (Exception e) { cell = new PdfPCell(new Phrase(bundle.getString("signature.error"), NORMAL_12)); lifeCycleTable.addCell(cell); } } else { cell = new PdfPCell(new Phrase("")); lifeCycleTable.addCell(cell); } } } } preface.add(lifeCycleTable); }
From source file:com.github.ukase.service.PdfRenderer.java
License:Open Source License
@Autowired private PdfRenderer(WaterMarkSettings settings, ResourceProvider provider) throws IOException, DocumentException { this.provider = provider; this.waterMark = settings; BaseFont baseFont = BaseFont.createFont(provider.getDefaultFont(), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); this.font = new Font(baseFont, waterMark.getSize(), 0, BaseColor.LIGHT_GRAY); }
From source file:com.icebreak.p2p.front.controller.trade.download.InvestReceiptPDFCreator.java
/** * ???//from ww w .j a v a 2s.co m * @param tradeId * @param detailId * @param servletPath * @return ? byte[] * @throws Exception */ public byte[] creatFileData4Receipt(long tradeId, long detailId, String servletPath) throws Exception { FileInputStream fis = null; BufferedInputStream buff = null; String fileKey = tradeId + "_" + detailId;//System.currentTimeMillis() + ""; String filePath = servletPath + "/resources/pdf/investReceipt_" + fileKey + ".pdf"; this.receiptFilePath = filePath; File file = new File(filePath); if (!file.exists()) { String timeLimit = ""; String interestRate = ""; String guaranteeName = ""; String investFlowCode = null; String investor = ""; String investorReal = ""; String investorCertNo = ""; String loanner = ""; String loannerReal = ""; String loannerCertNo = ""; String investAmount = ""; String totalAmountStr = ""; String effectiveDate = ""; String expireDate = ""; Trade trade = tradeService.getByTradeId(tradeId); effectiveDate = DateUtil.simpleFormat(trade.getEffectiveDateTime()); expireDate = DateUtil.simpleFormat(trade.getExpireDateTime()); LoanDemandDO loanDemand = loanDemandManager.queryLoanDemandByDemandId(trade.getDemandId()); guaranteeName = loanDemand.getGuaranteeName(); if ("W".equals(loanDemand.getTimeLimitUnit()) || "M".equals(loanDemand.getTimeLimitUnit())) { timeLimit = loanDemand.getTimeLimit() + ""; } else if ("Y".equals(loanDemand.getTimeLimitUnit())) { timeLimit = loanDemand.getTimeLimit() + ""; } else { timeLimit = loanDemand.getTimeLimit() + ""; } interestRate = CommonUtil.mul(loanDemand.getInterestRate(), 100) + "%"; List<UserInvestEntry> userInvests = tradeService.getEntriesByTradeIdAndDetailId(tradeId, detailId); long totalAmount = 0; if (userInvests != null && userInvests.size() > 0) { UserInvestEntry tradeItem = userInvests.get(0); investAmount = MoneyUtil.getFormatAmount(tradeItem.getAmount()); long investorId = userInvests.get(0).getInvestorId(); long loannerId = userInvests.get(0).getLoanerId(); investorCertNo = getCertNoByUserId(investorId); loannerCertNo = getCertNoByUserId(loannerId); investor = userInvests.get(0).getInvestorUserName(); investorReal = userInvests.get(0).getInvestorRealName(); loannerReal = userInvests.get(0).getLoanerRealName(); loanner = userInvests.get(0).getLoanerUserName(); totalAmount = userInvests.get(0).getAmount(); } //? /*interest = caculateInterest(new Money(totalAmount), loanDemand.getInterestRate(), loanDemand.getTimeLimit(), loanDemand.getTimeLimitUnit());*/ long divisionAmount = 0; long profitAmount = 0; List<TradeDetail> details = tradeService.getInvestProfitTrade(detailId); if (details != null && details.size() > 0) { for (TradeDetail detail : details) { divisionAmount += detail.getAmount(); if (detail.getProfitType() > 0) { profitAmount += detail.getAmount(); } } } totalAmount += divisionAmount; TradeFlowCode tradeFlow = tradeService.queryInvestFlowCodesByTradeDetailId(detailId); if (tradeFlow != null) { investFlowCode = tradeFlow.getTradeFlowCode(); } String guaranteeLicenseNo = ""; Map<String, Object> cond = new HashMap<String, Object>(); cond.put("roleId", 8L); cond.put("tradeId", trade.getId()); List<TradeQueryDetail> det = loanDemandManager.getTradeDetailByConditions(cond); if (det != null && det.size() > 0) { tradeFlow = tradeService.queryInvestFlowCodesByTradeDetailId(det.get(0).getId()); if (tradeFlow != null) { guaranteeLicenseNo = tradeFlow.getTradeFlowCode(); } } LoanDemandDO demand = loanDemandManager.queryLoanDemandByDemandId(trade.getDemandId()); long divisionTemplateId = demand.getDivisionTemplateId(); DivisionTemplateLoanDO divisionTemplateLoan = divisionTemplateLoanService .getByBaseId(divisionTemplateId); List<DivsionRuleRole> investRolelist = divisionService .getRuleRole(String.valueOf(divisionTemplateLoan.getInvestTemplateId())); List<DivsionRuleRole> repayRolelist = divisionService .getRuleRole(String.valueOf(divisionTemplateLoan.getRepayTemplateId())); //?? double totalAnnualInterest = 0; investRolelist.addAll(repayRolelist); if (investRolelist != null && investRolelist.size() > 0) { for (DivsionRuleRole druleRole : investRolelist) { if (DivisionPhaseEnum.INVESET_PHASE.code().equals(druleRole.getPhase())) { if ("11".equals(String.valueOf(druleRole.getRoleId()))) { totalAnnualInterest += druleRole.getRule(); } } } } totalAmountStr = MoneyUtil.getFormatAmount(totalAmount); String divisionAmountStr = MoneyUtil.getFormatAmount(divisionAmount); FileOutputStream fos = null; Document doc = new Document(PageSize.A4, 20, 20, 140, 20); try { fos = new FileOutputStream(filePath); PdfWriter writer = PdfWriter.getInstance(doc, fos); doc.open(); // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); Font titleChinese = new Font(bfChinese, 20, Font.BOLD); // ? Paragraph title = new Paragraph(AppConstantsUtil.getProductName() + "?", titleChinese);// title.setAlignment(Element.ALIGN_CENTER); // title.setLeading(1f);//?//? doc.add(title); Font fontZH = new Font(bfChinese, 12, Font.NORMAL); float[] widths = { 20f, 30f, 25f, 25f }; PdfPTable table = new PdfPTable(widths); table.setSpacingBefore(20f);// ? table.setTotalWidth(500);// table.setWidthPercentage(100);//%100 // table.getDefaultCell().setBorder(0);// PdfPCell cell; // cell = new PdfPCell(new Paragraph("?",fontZH)); // cell.setColspan(4); // table.addCell(cell); cell = new PdfPCell(new Paragraph("??", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(AppConstantsUtil.getPlatformName(), fontZH)); table.addCell(cell); cell = new PdfPCell(new Paragraph("?", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(loanDemand.getRepayDivisionWayMsg(), fontZH)); table.addCell(cell); cell = new PdfPCell(new Paragraph("", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(interestRate, fontZH)); table.addCell(cell); cell = new PdfPCell(new Paragraph("?", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(timeLimit, fontZH)); table.addCell(cell); cell = new PdfPCell(new Paragraph("??", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(guaranteeName, fontZH)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("??", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell( new Paragraph(StringUtil.nullToEmpty(loanDemand.getGuaranteeLicenseNo()), fontZH)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph((loanDemand.getLoanAmount() / 100) + "", fontZH)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(loanDemand.getLoanPurpose(), fontZH)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("??", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Paragraph(investFlowCode, fontZH)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("?", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Paragraph("??", fontZH)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setColspan(2); table.addCell(cell); Paragraph iparas = new Paragraph("??" + investor, fontZH); iparas.add(Chunk.NEWLINE); iparas.add("??" + investorReal); iparas.add(Chunk.NEWLINE); iparas.add("??" + StringUtil.subString(investorCertNo, 7, "****")); iparas.add(Chunk.NEWLINE); iparas.add("?" + effectiveDate); iparas.add(Chunk.NEWLINE); iparas.add("" + expireDate); iparas.add(Chunk.NEWLINE); iparas.add("()" + investAmount); iparas.add(Chunk.NEWLINE); iparas.add("()" + divisionAmountStr); iparas.add(Chunk.NEWLINE); iparas.add("()" + totalAmountStr); cell = new PdfPCell(iparas); cell.setColspan(2); cell.setRowspan(8); cell.setMinimumHeight(120); table.addCell(cell); Paragraph paras = new Paragraph("??" + loanner, fontZH); paras.add(Chunk.NEWLINE); paras.add("??" + loannerReal); paras.add(Chunk.NEWLINE); paras.add("??" + StringUtil.subString(loannerCertNo, 7, "****")); paras.add(Chunk.NEWLINE); paras.add("?" + effectiveDate); paras.add(Chunk.NEWLINE); paras.add("" + expireDate); paras.add(Chunk.NEWLINE); paras.add(Chunk.NEWLINE); paras.add(Chunk.NEWLINE); paras.add("()" + totalAmountStr); cell = new PdfPCell(paras); cell.setColspan(2); cell.setRowspan(8); table.addCell(cell); doc.add(table); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); Paragraph tips = new Paragraph(" ?? ?" + AppConstantsUtil.getPlatformName() + "", fontZH);// tips.setLeading(1f);//?//? doc.add(tips); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); tips = new Paragraph(" ??" + AppConstantsUtil.getPlatformAddress(), fontZH);// tips.setLeading(1f);//?//? doc.add(tips); // XMLWorkerHelper.getInstance().parseXHtml(writer, doc, // new ByteArrayInputStream(str.getBytes())); doc.close(); logger.info("?"); } catch (Exception e) { logger.error("?", e); throw new Exception("?:" + e.getMessage()); } finally { if (fos != null) { fos.close(); } } } byte[] data = new byte[1024]; file = new File(filePath); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] temp = new byte[1024]; int size = 0; fis = new FileInputStream(file); buff = new BufferedInputStream(fis); int i = 0; while ((size = buff.read(temp)) != -1) { out.write(temp, 0, size); i += 1; } data = out.toByteArray(); buff.close(); fis.close(); //file.delete(); if (i == 0 && size == -1) { //PDF file.delete(); } } catch (FileNotFoundException e) { logger.error("?", e); } catch (IOException e) { logger.error("delete file", e); } finally { if (fis != null) { fis.close(); } } return data; }
From source file:com.prjhuellvotweb.controlador.PDF.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Preguntar por la sesion del usuario admin HttpSession sessionOk = request.getSession(true); if (sessionOk.getAttribute("admin") != null) { //cambiar a tipo application/pdf response.setContentType("application/pdf;charset=UTF-8"); //flujo de salida OutputStream out = response.getOutputStream(); String texto = request.getParameter("report"); //texto = "Reporte de los proyectos Sena CTGI (Centro tecnologico de gestion industrial) donde se dan a conocer" // + " los nombres de los proyectos y cantidad de votos obtenidos para cada proyecto."; try {// w w w . jav a 2s . c o m Connection con = Conexion.conectar("mysql"); DAOVoto dao = new DAOVoto(); List<List> lista = dao.estadisticaNumeroVotos(); Voto t = dao.contarVotos(); int to = t.getIdUsuario(); if (!lista.isEmpty() && lista.size() > 0) { try { //programar pdf Document documento = new Document(); //asosciar documento con la salida PdfWriter.getInstance(documento, out);// salida del cocumento en pdf //abrir documento documento.open(); Paragraph par2 = new Paragraph(); Paragraph par4 = new Paragraph(); //agregar una imagen logo sena al pdf Image imagenes = Image .getInstance(getServletContext().getRealPath("") + "/Multimedia/reportes.png"); //Centrar la imagen imagenes.setAlignment(Element.ALIGN_CENTER); //tamao de la imagen imagenes.scaleToFit(530, 520); //agg imagen al documento F:\\Documentos\\yo\\huellvot 2 17-06-2016\\PrjHuellVotWeb\\web\\iCO.png //documento.add(imghuellvot); documento.add(imagenes); //Agg salto de linea par2.add(new Phrase(Chunk.NEWLINE)); par2.add(new Phrase(Chunk.NEWLINE)); //fuente del pdf, tipo de fuente famimilia tamao de letra //Importar ttf que contiene el tipo de letra FontFactory.register( "C:\\Users\\pc\\Desktop\\PrjHuellVotWeb\\web\\fonts\\roboto\\Roboto-Bold.ttf", "Roboto"); //Font fondescripcion = FontFactory.getFont("Roboto"); Font fondescripcion = new Font(Font.getFamily("Roboto"), 16, Font.NORMAL, BaseColor.BLACK); //texto de la descripcion par2.add(new Phrase(texto, fondescripcion)); //justificar descripcion par2.setAlignment(Element.ALIGN_JUSTIFIED); //Agg salto de linea par2.add(new Phrase(Chunk.NEWLINE)); par2.add(new Phrase(Chunk.NEWLINE)); //agregar descripcion al documento documento.add(par2);//agregar todas las propiedades de la descripcin //crear una tabla PdfPTable tabla = new PdfPTable(5);//( Numero de columnas de la tabla) //columnas de la tabla, cabezera y agg un estilo PdfPCell celda = new PdfPCell( new Paragraph("Nmero", FontFactory.getFont("Roboto", 14, Font.BOLD))); PdfPCell celda1 = new PdfPCell( new Paragraph("Nombre", FontFactory.getFont("Roboto", 14, Font.BOLD))); celda1.setColspan(3); PdfPCell celda2 = new PdfPCell( new Paragraph("Votos", FontFactory.getFont("Roboto", 14, Font.BOLD))); //Color de fondo celda.setBackgroundColor(new BaseColor(252, 115, 35)); celda1.setBackgroundColor(new BaseColor(252, 115, 35)); celda2.setBackgroundColor(new BaseColor(252, 115, 35)); //Centrar celda.setHorizontalAlignment(Element.ALIGN_CENTER); celda1.setHorizontalAlignment(Element.ALIGN_CENTER); celda2.setHorizontalAlignment(Element.ALIGN_CENTER); //padding celda.setPadding(8.0f); celda1.setPadding(8.0f); celda2.setPadding(8.0f); //agg columna ala tabla tabla.addCell(celda); tabla.addCell(celda1); tabla.addCell(celda2); for (int i = 0; i < lista.size(); i++) { List l = lista.get(i); //Convertir el entero a string String num = String.valueOf(l.get(0)); String nom = String.valueOf(l.get(1)); String tot = String.valueOf(l.get(2)); //Agregar valores a las celdas PdfPCell c = new PdfPCell( new Paragraph(num, FontFactory.getFont("Roboto", 12, Font.BOLD))); PdfPCell c1 = new PdfPCell( new Paragraph(nom, FontFactory.getFont("Roboto", 12, Font.BOLD))); c1.setColspan(3); PdfPCell c2 = new PdfPCell( new Paragraph(tot, FontFactory.getFont("Roboto", 12, Font.BOLD))); //Padding para las celdas c.setPadding(4.0f); c1.setPadding(4.0f); c2.setPadding(4.0f); //Centrar contenido de celda c.setHorizontalAlignment(Element.ALIGN_CENTER); c2.setHorizontalAlignment(Element.ALIGN_CENTER); //mostrar los resultados de cada columna los agrega a la tabla tabla.addCell(c); tabla.addCell(c1); tabla.addCell(c2); } PdfPCell c1 = new PdfPCell(new Paragraph("Total Votos: ", fondescripcion)); c1.setColspan(4); PdfPCell c2 = new PdfPCell(new Paragraph("" + to, fondescripcion)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); c2.setHorizontalAlignment(Element.ALIGN_CENTER); c1.setPadding(4.0f); c2.setPadding(4.0f); tabla.addCell(c1); tabla.addCell(c2); //Agrega la tabla a el documento documento.add(tabla); //agregar fecha Font fonfecha = new Font(Font.getFamily("Roboto"), 12, Font.NORMAL, BaseColor.LIGHT_GRAY); par4.add(new Phrase("Expedido por HuellVot", fonfecha)); DateFormat formato = DateFormat.getDateInstance(DateFormat.FULL); par4.add(new Paragraph(formato.format(new Date()))); documento.add(par4); //cerrar el documento documento.close(); } catch (DocumentException | IOException e) { e.getMessage(); System.out.println("Error al generar el reporte PDF" + e); } } else { try { Document documento = new Document(); PdfWriter.getInstance(documento, out);// salida del cocumento en pdf //abrir documento documento.open(); System.out.println("no hat datos"); //agregar una imagen logo sena al pdf Image imagenes = Image.getInstance( "C:\\Users\\pc\\Desktop\\PrjHuellVotWeb\\web\\Multimedia\\reportes.png"); //Centrar la imagen imagenes.setAlignment(Element.ALIGN_CENTER); //tamao de la imagen imagenes.scaleToFit(530, 520); //agg imagen al documento F:\\Documentos\\yo\\huellvot 2 17-06-2016\\PrjHuellVotWeb\\web\\iCO.png //documento.add(imghuellvot); documento.add(imagenes); Paragraph par1 = new Paragraph(); Paragraph par2 = new Paragraph(); //Agg salto de linea par1.add(new Phrase(Chunk.NEWLINE)); par1.add(new Phrase(Chunk.NEWLINE)); //fuente del pdf, tipo de fuente famimilia tamao de letra //Importar ttf que contiene el tipo de letra FontFactory.register( "C:\\Users\\pc\\Desktop\\PrjHuellVotWeb\\web\\fonts\\roboto\\Roboto-Bold.ttf", "Roboto"); //Font fondescripcion = FontFactory.getFont("Roboto"); Font fondescripcion = new Font(Font.getFamily("Roboto"), 16, Font.NORMAL, BaseColor.BLACK); //texto de la descripcion par1.add(new Phrase("lo sentimos pero no hay datos para mostrar.!", fondescripcion)); //justificar descripcion par1.setAlignment(Element.ALIGN_CENTER); //Agg salto de linea par1.add(new Phrase(Chunk.NEWLINE)); par1.add(new Phrase(Chunk.NEWLINE)); //agregar descripcion al documento documento.add(par1);//agregar todas las propiedades de la descripcin //agregar fecha Font fonfecha = new Font(Font.getFamily("Roboto"), 12, Font.NORMAL, BaseColor.LIGHT_GRAY); par2.add(new Phrase("Expedido por HuellVot", fonfecha)); DateFormat formato = DateFormat.getDateInstance(DateFormat.FULL); par2.add(new Paragraph(formato.format(new Date()))); documento.add(par2); //cerrar el documento documento.close(); } catch (DocumentException ex) { ex.getMessage(); System.out.println("Error al generar el reporte PDF sin datos registrados" + ex); } } } finally { out.close(); } } else { sessionOk.invalidate(); response.sendRedirect("index.jsp"); } }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document ESingnature(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> ESingnature "); try {// w w w . ja va 2s .co m document.newPage(); PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); PdfPCell c1 = new PdfPCell(new Phrase("E-singnature ")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } Iterator itr = null; CandidateESignature esignature = new CandidateESignature(); if (addressbook.getCandidateESignatures().size() > 0) { itr = addressbook.getCandidateESignatures().iterator(); esignature = (CandidateESignature) itr.next(); } c1 = new PdfPCell(new Phrase("Branch : " + esignature.getBranch(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Servicing Department : " + esignature.getServiceDepartment(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("City : " + esignature.getCity(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Agent Code : " + esignature.getAgentId(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int i = 0; i < 4; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } document.add(table); table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); table.setWidths(new int[] { 80, 20 }); c1 = new PdfPCell(new Phrase("Presently attached with another insurance Company ? ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t No", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Presently in contact with any other AIA'S servicing Department ? ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t No", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Taken LOMBRA occupational test or PSP test in the past ? If Yes, ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t No", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 2; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Please provide the result. ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 5; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } document.add(table); Paragraph para1 = new Paragraph(); para1.add(new Chunk("Applicant's Declaration ", font)); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); for (int i = 0; i < 4; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Application Date", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("Applicant/Candidate Name :", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); if (esignature.getApplicationDate() != null) { c1 = new PdfPCell(new Phrase(format.format(esignature.getApplicationDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } else { c1 = new PdfPCell(new Phrase("", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase(esignature.getCandidateName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); for (int i = 0; i < 4; i++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } document.add(table); para1 = new Paragraph(); para1.add(new Chunk("E-Signature : ", font)); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); if (esignature.geteSignaturePhoto() != null) { Image image = Image.getInstance(esignature.geteSignaturePhoto()); para1 = new Paragraph(); para1.add(image); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); } else { para1 = new Paragraph(); para1.add(""); para1.setAlignment(Element.ALIGN_LEFT); para1.setSpacingAfter(5f); document.add(para1); } } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> ESingnature " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document personalCertification(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalCertification "); try {/*ww w . ja va 2 s. c o m*/ /* New Page */ document.newPage(); PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); int i = 0; for (Iterator itr = addressbook.getCandidateProfessionalCertifications().iterator(); itr.hasNext();) { CandidateProfessionalCertification procertification = (CandidateProfessionalCertification) itr .next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("PERSONAL CERTIFICATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Certificate Name: " + procertification.getCertificateName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Chrater Agency: " + procertification.getCharterAgency(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Charter Date : " + format.format(procertification.getCharterDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalCertification " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document Education(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> Education "); try {/*w ww . j a v a 2s . c o m*/ /* New Page */ document.newPage(); PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); int i = 0; for (Iterator itr = addressbook.getCandidateEducations().iterator(); itr.hasNext();) { CandidateEducation candidateEducation = (CandidateEducation) itr.next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("EDUCATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Start Date: " + format.format(candidateEducation.getStartDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("End Date: " + format.format(candidateEducation.getEndDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Witness : " + candidateEducation.getWitness(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Education : " + candidateEducation.getEducation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Education Level : " + candidateEducation.getEducationLevel(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("School : " + candidateEducation.getSchool(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Witness Contect Number : " + candidateEducation.getWitnessContactNo(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> Education " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document workExperience(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> workExperience "); try {/* ww w . ja v a 2 s .c o m*/ document.newPage(); PdfPTable table = new PdfPTable(3); table.setSpacingBefore(10); table.setWidthPercentage(100f); int i = 0; for (Iterator itr = addressbook.getCandidateWorkExperiences().iterator(); itr.hasNext();) { CandidateWorkExperience candidateWorkExp = (CandidateWorkExperience) itr.next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("WORK EXPERIENCE")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell( new Phrase("Start Date: " + format.format(candidateWorkExp.getStartDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("End Date: " + format.format(candidateWorkExp.getEndDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Witness: " + candidateWorkExp.getWitness(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Unit : " + candidateWorkExp.getUnit(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Occupation : " + candidateWorkExp.getOccupation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Witness Contect Number : \n\n\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + candidateWorkExp.getWitnessContactNo(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(25f); //c1.setPaddingBottom(10f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Income : " + candidateWorkExp.getIncome(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Possition : " + candidateWorkExp.getPosition(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> workExperience " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document familyInformation(Document document, PdfWriter writer, AddressBook addressbook) { // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> familyInformation "); try {/*from w w w.j a va 2 s .co m*/ /* New Page */ document.newPage(); PdfPTable table = new PdfPTable(3); table.setSpacingBefore(10); table.setWidthPercentage(100f); //Set familylist=addressbook.getCandidateFamilyInfos(); int i = 0; for (Iterator itr = addressbook.getCandidateFamilyInfos().iterator(); itr.hasNext();) { CandidateFamilyInfo candidateFamilyInfo = (CandidateFamilyInfo) itr.next(); if (i != 0) { PdfPCell c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } i++; PdfPCell c1 = new PdfPCell(new Phrase("FAMILY INFORMATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Name: " + candidateFamilyInfo.getName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Unit: " + candidateFamilyInfo.getUnit(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Possition: " + candidateFamilyInfo.getPosition(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 3; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Relationship : " + candidateFamilyInfo.getRelationship(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Occupation : " + candidateFamilyInfo.getOccupation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("Phone : " + candidateFamilyInfo.getPhoneNo(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); } document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> familyInformation " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }
From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java
License:Open Source License
private static Document personalInformation(Document document, PdfWriter writer, AddressBook addressbook, Font normalFontCH) {//from ww w . jav a 2s. c om // TODO Auto-generated method stub log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalInformation "); try { PdfPTable table = new PdfPTable(2); table.setSpacingBefore(10); table.setWidthPercentage(100f); PdfPCell c1 = new PdfPCell(new Phrase("PERSONAL INFORMATION")); c1.setHorizontalAlignment(Element.ALIGN_LEFT); c1.setColspan(4); c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP); c1.setFixedHeight(30f); c1.setBackgroundColor(BaseColor.LIGHT_GRAY); c1.setBorder(Rectangle.BOX); c1.setFixedHeight(25f); table.addCell(c1); table.setHeaderRows(1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Candidate's Name: " + addressbook.getName(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("NRIC: " + addressbook.getNric(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("??* ", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("???(*) ", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Date of Birth: " + format.format(addressbook.getBirthDate()), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Gender: " + addressbook.getGender(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Age: " + addressbook.getAge(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Place of Birth: " + addressbook.getBirthPlace(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("(*)", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Education: " + addressbook.getEducation(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Maritial Status: " + addressbook.getMarritalStatus(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Annual Income: " + addressbook.getYearlyIncome(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Work Experience: " + addressbook.getWorkingYearExperience(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase("*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase( "Address : " + addressbook.getResidentialAddress1() + " ," + addressbook.getResidentialAddress2() + " , " + addressbook.getResidentialAddress3(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); c1 = new PdfPCell(new Phrase("??*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Postal Code: " + addressbook.getResidentialPostalCode(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.NO_BORDER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Mobile Number: " + addressbook.getMobilePhoneNo(), font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); table.addCell(c1); c1 = new PdfPCell(new Phrase("??*", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", normalFontCH)); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); for (int j = 0; j < 2; j++) { c1 = new PdfPCell(new Phrase(" ", font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); table.addCell(c1); } c1 = new PdfPCell(new Phrase("Email Address: " + addressbook.geteMailId(), font)); c1.setBorder(Rectangle.NO_BORDER); c1.setLeading(4f, 0f); c1.setFixedHeight(15f); //c1.setPaddingLeft(30f); c1.setBorder(Rectangle.BOTTOM); table.addCell(c1); c1 = new PdfPCell(new Phrase(" ", font)); c1.setFixedHeight(15f); c1.setBorder(Rectangle.BOTTOM); c1.setLeading(4f, 0f); table.addCell(c1); document.add(table); } catch (Exception e) { // TODO Auto-generated catch block log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalInformation " + e.getMessage()); e.printStackTrace(); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString()); } return document; }