List of usage examples for com.lowagie.text Font Font
public Font(int family, float size, int style)
From source file:org.egov.works.web.actions.measurementbook.MeasurementBookPDFGenerator.java
License:Open Source License
public void generatePDF() { final String headerText = pdfLabel.get("mbpdf.header"); try {/*from w ww .ja v a 2 s .com*/ // start header Part final Paragraph headerTextPara = new Paragraph( new Chunk(headerText, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); headerTextPara.setAlignment(Element.ALIGN_CENTER); document.add(headerTextPara); document.add(spacer()); if (mbHeader != null) { String toPageno = ""; if (mbHeader.getToPageNo() == null || mbHeader.getToPageNo().intValue() == 0) toPageno = mbHeader.getFromPageNo().toString(); else toPageno = mbHeader.getToPageNo().toString(); document.add(makeParaWithFont(8, " \t \t \t \t \t " + pdfLabel.get("mbpdf.refno") + mbHeader.getMbRefNo() + " \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t " + pdfLabel.get("mbpdf.pageno") + " : " + mbHeader.getFromPageNo() + " to " + toPageno + " \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t " + pdfLabel.get("mbpdf.date") + sdf.format(mbHeader.getMbDate()), Element.ALIGN_LEFT)); } document.add(spacer()); includeRevisionTypeColumn = false; // /Find if revision type Non tendered and Lump sum items are there areNTOrLSItemsPresent(mbHeader); // creating label row PdfPTable mbTable = createMbTable(); if (mbHeader != null) mbTable = createMbData(mbTable, mbHeader); document.add(mbTable); document.add(spacer()); document.newPage(); // approval details table PdfPTable approvaldetailsTable = null; if (mbHeader != null) approvaldetailsTable = createApprovalDetailsTable(mbHeader); document.add(makePara(8, pdfLabel.get("mbpdf.approvaldetails"))); document.add(spacer()); document.add(approvaldetailsTable); document.close(); } catch (final DocumentException e) { throw new ApplicationRuntimeException(MEASUREMENTBOOK_PDF_ERROR, e); } }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
public void generatePDF() { nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(10);//www .j a v a 2s .c o m final List<String> tenderTypeList = worksService.getTendertypeList(); if (tenderTypeList != null && !tenderTypeList.isEmpty()) percTenderType = tenderTypeList.get(0); final String headerText = pdfLabel.get("tenderNegotiationpdf.header"); try { final Paragraph headerTextPara = new Paragraph( new Chunk(headerText, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); headerTextPara.setAlignment(Element.ALIGN_CENTER); document.add(headerTextPara); document.add(makePara(cityName, Element.ALIGN_RIGHT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getWorksPackage() != null) { worksPackgeReq = YES; worksPackage = tenderResponse.getTenderEstimate().getWorksPackage(); } String deptName = ""; if (YES.equalsIgnoreCase(worksPackgeReq)) { deptName = tenderResponse.getTenderEstimate().getWorksPackage().getDepartment().getName(); document.add(makePara(deptName, Element.ALIGN_RIGHT)); if (getWardList(worksPackage) != null) document.add(makePara( pdfLabel.get("tenderNegotiationpdf.ward") + "/" + pdfLabel.get("tenderNegotiationpdf.zone") + getWardList(worksPackage), Element.ALIGN_LEFT)); } else { if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getExecutingDepartment() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getExecutingDepartment() .getName() != null) deptName = tenderResponse.getTenderEstimate().getAbstractEstimate().getExecutingDepartment() .getName(); document.add(makePara(deptName, Element.ALIGN_RIGHT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getWard().getParent() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getWard() != null) document.add(makePara(pdfLabel.get("tenderNegotiationpdf.ward") + "/" + pdfLabel.get("tenderNegotiationpdf.zone") + tenderResponse.getTenderEstimate().getAbstractEstimate().getWard().getName() + "/" + tenderResponse.getTenderEstimate().getAbstractEstimate().getWard().getParent() .getName(), Element.ALIGN_LEFT)); } if (YES.equalsIgnoreCase(worksPackgeReq)) document.add(makePara( pdfLabel.get("tenderNegotiationpdf.nameofwork") + tenderResponse.getTenderEstimate().getWorksPackage().getName(), Element.ALIGN_LEFT)); else if (tenderResponse != null && tenderResponse.getTenderEstimate() != null) document.add(makePara( pdfLabel.get("tenderNegotiationpdf.nameofwork") + tenderResponse.getTenderEstimate().getAbstractEstimate().getName(), Element.ALIGN_LEFT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getTenderHeader() != null && tenderResponse.getTenderEstimate().getTenderHeader().getTenderNo() != null) document.add(makePara( pdfLabel.get("tenderNumber") + tenderResponse.getTenderEstimate().getTenderHeader().getTenderNo(), Element.ALIGN_LEFT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getWorksPackage() != null) document.add(makePara( pdfLabel.get("tenderFileNo") + tenderResponse.getTenderEstimate().getWorksPackage().getTenderFileNumber(), Element.ALIGN_LEFT)); document.add(spacer()); String tenderDate = ""; if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getTenderHeader() != null && tenderResponse.getTenderEstimate().getTenderHeader().getTenderDate() != null) tenderDate = sdf.format(tenderResponse.getTenderEstimate().getTenderHeader().getTenderDate()); document.add( makePara(pdfLabel.get("tenderNegotiationpdf.tenderdate") + tenderDate, Element.ALIGN_RIGHT)); document.add(spacer()); PdfPTable contractorTable = null; if (tenderResponse != null) { contractorTable = createContractorTable(tenderResponse); document.add(contractorTable); } document.add(spacer()); if (tenderResponse != null && tenderResponse.getTenderEstimate().getTenderType().equalsIgnoreCase(percTenderType)) { PdfPTable negotiationTable = null; negotiationTable = createNegotiationTable(tenderResponse, tenderResponse.getTenderResponseContractors().get(0).getContractor()); document.add(negotiationTable); document.add(spacer()); if (negotiationTable != null && negotiationTable.getRows().size() > 8) document.newPage(); } else if (tenderResponse != null && !tenderResponse.getTenderEstimate().getTenderType().equalsIgnoreCase(percTenderType)) createNegotiationTableForContractors(tenderResponse); if (tenderResponse != null && tenderResponse.getNegotiationPreparedBy() != null && tenderResponse.getNegotiationPreparedBy().getEmployeeName() != null) document.add(makePara(pdfLabel.get("tenderNegotiationpdf.preparedby") + " " + tenderResponse.getNegotiationPreparedBy().getEmployeeName())); document.add(spacer()); document.add(spacer()); document.add(makePara(pdfLabel.get("tenderNegotiationpdf.checkedby"))); document.newPage(); PdfPTable approvaldetailsTable = null; if (tenderResponse != null) approvaldetailsTable = createApprovalDetailsTable(tenderResponse); if (approvaldetailsTable != null && approvaldetailsTable.getRows().size() != 1) { document.add(makePara(pdfLabel.get("tenderNegotiationpdf.approvaldetails"))); document.add(spacer()); document.add(approvaldetailsTable); } document.close(); } catch (final DocumentException e) { throw new ApplicationRuntimeException(TENDER_PDF_ERROR, e); } }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addDocumentFooter(Document d, String[] texts) throws DocumentException { Font smallFont = new Font(Font.TIMES_ROMAN, 12, Font.BOLD); Font smallGreenFont = new Font(Font.TIMES_ROMAN, 12, Font.BOLD, Color.GREEN); Font smallDarkGreenFont = new Font(Font.TIMES_ROMAN, 12, Font.BOLD, new Color(135, 194, 53)); Paragraph footer = new Paragraph(); this.addLineSeparator(footer, 1); footer.setAlignment(Paragraph.ALIGN_CENTER); this.addEmptyLine(footer, 1); footer.add(new Paragraph(texts[0], smallFont)); footer.add(new Paragraph(texts[1], smallGreenFont)); footer.add(new Paragraph(texts[2], smallDarkGreenFont)); this.addEmptyLine(footer, 1); d.add(footer);/* www.j a v a 2 s. com*/ }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTableRow(Table t, String title, String value) throws BadElementException { // Fonts Definition Font boldFont = new Font(Font.TIMES_ROMAN, 12, Font.BOLD); Cell cell = new Cell(new Chunk(title, boldFont)); cell.setHeader(true);/*from w ww . j a va 2 s .c om*/ t.addCell(cell); t.addCell(value); }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTitleOne(Document d, String text) throws DocumentException { Font titleFont = new Font(Font.TIMES_ROMAN, 24, Font.BOLD); Paragraph p = new Paragraph(); this.addEmptyLine(p, 1); p.add(new Paragraph(text, titleFont)); this.addEmptyLine(p, 1); d.add(p);//from w ww. j a v a 2 s . c o m }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTitleTwo(Document d, String text) throws DocumentException { Font subtitleFont = new Font(Font.TIMES_ROMAN, 16, Font.BOLD); Paragraph p = new Paragraph(); this.addEmptyLine(p, 1); p.add(new Paragraph(text, subtitleFont)); this.addEmptyLine(p, 1); d.add(p);/* w w w. ja v a 2 s . co m*/ }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTitleTwo(Document d, String text, boolean underline) throws DocumentException { Font subtitleFont = new Font(Font.TIMES_ROMAN, 16, Font.BOLD); Paragraph p = new Paragraph(); this.addEmptyLine(p, 1); p.add(new Paragraph(text, subtitleFont)); if (underline) this.addLineSeparator(p, 1); this.addEmptyLine(p, 1); d.add(p);// w w w . j a va 2 s. c o m }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTitleThree(Document d, String text) throws DocumentException { Font layerNameFont = new Font(Font.TIMES_ROMAN, 14, Font.BOLD); Paragraph p = new Paragraph(); this.addEmptyLine(p, 1); p.add(new Paragraph(text, layerNameFont)); this.addLineSeparator(d, 1); d.add(p);// w w w.jav a 2 s .co m }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addTableHeader(Table t, String text) throws BadElementException { Chunk chunk = new Chunk(text, new Font(Font.TIMES_ROMAN, 15, Font.BOLD)); Cell cell = new Cell(chunk); cell.setHorizontalAlignment(Cell.ALIGN_CENTER); cell.setHeader(true);//from w w w . j a v a 2 s . c om cell.setColspan(2); t.addCell(cell); }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private void addImageSection(Document d, String mapName, Long currentSessionId) throws BadElementException, MalformedURLException, IOException, DocumentException { Image mapImage = Image.getInstance(mapsHome + mapName + "_T_" + currentSessionId + ".png"); mapImage.scaleToFit(550, 413);//from ww w . j a v a2s . c o m mapImage.setAlignment(Image.ALIGN_LEFT); // scale Image scaleImage = Image.getInstance(mapsHome + "scale.jpg"); scaleImage.scaleToFit(30, 150); scaleImage.setAlignment(Image.ALIGN_RIGHT); Paragraph images = new Paragraph(); images.setAlignment(Paragraph.ALIGN_RIGHT); //upper scale leyend images.add(new Chunk(this.getI18nString("pdfReport.scaleUpper") + "\n\n\n\n\n\n\n", new Font(Font.COURIER, 8, Font.BOLDITALIC))); // Map images.add(new Chunk(mapImage, 1F, 1F)); // Scale images.add(new Chunk(scaleImage, 1F, 1F)); // lower scale leyend images.add(new Chunk("\n" + this.getI18nString("pdfReport.scaleLower") + "\n", new Font(Font.COURIER, 8, Font.BOLDITALIC))); d.add(images); }