List of usage examples for com.lowagie.text Element ALIGN_CENTER
int ALIGN_CENTER
To view the source code for com.lowagie.text Element ALIGN_CENTER.
Click Source Link
From source file:org.egov.works.utils.AbstractPDFGenerator.java
License:Open Source License
protected Paragraph centerPara(final Object value) { return makePara(value, Element.ALIGN_CENTER); }
From source file:org.egov.works.utils.AbstractPDFGenerator.java
License:Open Source License
protected Paragraph centerPara(final float fontSize, final Object value) { return makeParaWithFont(fontSize, value, Element.ALIGN_CENTER); }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected void createCertificate() throws DocumentException { final Paragraph headerTextPara = new Paragraph(new Chunk(pdfLabel.get("contractorbill.pdf.contractorbill"), new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD))); headerTextPara.setAlignment(Element.ALIGN_CENTER); document.add(headerTextPara);//from w ww . j av a 2 s.co m final Paragraph certificateheaderTextPara = new Paragraph(new Chunk( pdfLabel.get("contractorbill.pdf.certificate"), new Font(Font.COURIER, LARGE_FONT, Font.BOLD))); certificateheaderTextPara.setAlignment(Element.ALIGN_CENTER); document.add(certificateheaderTextPara); document.add(spacer()); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent1"))); document.add(spacer()); document.add(spacer()); document.add(rightPara( pdfLabel.get("contractorbill.pdf.juniorengineer") + "\t \t\t \t \t \t\t \t\t \t \t \t \t")); document.add(spacer()); document.add(rightPara(pdfLabel.get(dateLabel) + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t" + "\t \t\t \t\t \t \t \t \t\t \t\t\t\t \t\t \t\t")); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent2"))); document.add(spacer()); document.add(spacer()); document.add(rightPara(pdfLabel.get("contractorbill.pdf.exeasstengineer") + "\t \t")); document.add(spacer()); document.add(rightPara(pdfLabel.get(dateLabel) + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t" + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t\t \t \t\t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t")); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent3"))); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent4"))); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent5"))); document.add(spacer()); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent6"))); document.add(spacer()); document.add(spacer()); document.add(makePara(pdfLabel.get("contractorbill.pdf.juniorengineer") + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t " + tab2 + tab2 + "\t \t \t \t \t \t \t \t \t \t \t \t \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("contractorbill.pdf.exeasstengineer"))); document.add(spacer()); document.add(makePara(pdfLabel.get(dateLabel) + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + tab2 + tab2 + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \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(dateLabel))); }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createContractorBillHeader(final String title, final int i) { final PdfPTable contractorBillHeaderTable = new PdfPTable(3); contractorBillHeaderTable.getDefaultCell().setBorderWidth(0); if (i == 0) { contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); contractorBillHeaderTable.getDefaultCell().setColspan(4); contractorBillHeaderTable.addCell(title); } else if (i == 1) { contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); final Phrase headerTextPara = new Phrase(title, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD)); contractorBillHeaderTable.getDefaultCell().setColspan(3); contractorBillHeaderTable.addCell(headerTextPara); } else if (i == 2) { contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); contractorBillHeaderTable.getDefaultCell().setColspan(4); contractorBillHeaderTable.addCell(title + " " + deptName); }// w ww . j a v a 2s.c om return contractorBillHeaderTable; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createDeductionTypeLabelTable() { final PdfPTable deductionTypeLabel = new PdfPTable(11); deductionTypeLabel.getDefaultCell().setBorderWidth(1); deductionTypeLabel.getDefaultCell().setColspan(7); deductionTypeLabel.addCell(makePara(pdfLabel.get("contractorbill.pdf.deductions"))); deductionTypeLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); deductionTypeLabel.getDefaultCell().setColspan(1); deductionTypeLabel.addCell(""); deductionTypeLabel.addCell(""); deductionTypeLabel.addCell(""); deductionTypeLabel.addCell(""); return deductionTypeLabel; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createWorkValueLabelTable() { final PdfPTable createWorkValueLabel = new PdfPTable(11); createWorkValueLabel.getDefaultCell().setBorderWidth(1); createWorkValueLabel.getDefaultCell().setColspan(7); createWorkValueLabel.addCell(" "); createWorkValueLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); createWorkValueLabel.getDefaultCell().setColspan(2); createWorkValueLabel/*from w ww . ja va 2 s . c o m*/ .addCell(centerPara(pdfLabel.get("contractorbill.pdf.todate") + "\n" + " Rs. P.")); createWorkValueLabel .addCell(centerPara(pdfLabel.get("contractorbill.pdf.lastbill") + "\n" + " Rs. P.")); return createWorkValueLabel; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createDetailsForWorkOrderLabelTable() { final PdfPTable detailsForWorkOrderLabel = new PdfPTable(11); detailsForWorkOrderLabel.getDefaultCell().setBorderWidth(1); detailsForWorkOrderLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); detailsForWorkOrderLabel.getDefaultCell().setColspan(2); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.projectcode")); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.assetcode")); detailsForWorkOrderLabel.getDefaultCell().setColspan(1); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.Mbno")); detailsForWorkOrderLabel.getDefaultCell().setColspan(2); detailsForWorkOrderLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); detailsForWorkOrderLabel.addCell(blankSpace15 + pdfLabel.get("contractorbill.pdf.pages") + "\n" + blankSpace8 + pdfLabel.get("contractorbill.pdf.from") + blankSpace8 + pdfLabel.get("contractorbill.pdf.to")); detailsForWorkOrderLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); detailsForWorkOrderLabel.getDefaultCell().setColspan(4); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.estimateno") + " " + estimateNumber); return detailsForWorkOrderLabel; }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
public void generatePDF() { try {//from w w w. ja v a 2s. c om final Paragraph headerTextPara = new Paragraph( new Chunk(headerText, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); String projectCode; final String oldEstNo = ""; HeaderFooter hf; headerTextPara.setAlignment(Element.ALIGN_CENTER); document.add(headerTextPara); document.add(makePara("Executing Department:" + estimate.getExecutingDepartment().getName(), Element.ALIGN_LEFT)); if (estimate.getUserDepartment() != null) document.add( makePara("User Department:" + estimate.getUserDepartment().getName(), Element.ALIGN_LEFT)); final CFinancialYear estimateFinancialYear = estimate.getMultiYearEstimates().get(0).getFinancialYear(); addZoneYearHeader(estimate, estimateFinancialYear); document.add(makePara("Name of Work: " + estimate.getName(), Element.ALIGN_LEFT)); document.add(makePara("Description: " + estimate.getDescription(), Element.ALIGN_LEFT)); if (estimate.getProjectCode() != null) { projectCode = "Project Code : " + estimate.getProjectCode().getCode(); document.add(makePara(projectCode, Element.ALIGN_LEFT)); hf = new HeaderFooter(new Phrase("\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t\t \t \t \t \t\t \t \t \t \t\t \t \t " + "\t \t \t \t \t\t \t \t \t \t" + headerText.concat("\n") .concat("\t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t\t \t \t \t \t\t \t \t \t \t\t \t \t " + "\t \t \t \t \t\t \t \t \t \t ABSTRACT ESTIMATE") .concat("\n\n").concat("Name of Work: " + estimate.getName()).concat("\n") .concat("Description: " + estimate.getDescription()).concat("\n") .concat("Estimate Number: " + estimate.getEstimateNumber()).concat(oldEstNo) .concat("\n").concat(projectCode)), false); } else hf = new HeaderFooter(new Phrase("\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t\t \t \t \t \t\t \t \t \t \t\t \t \t " + "\t \t \t \t \t\t \t \t \t \t" + headerText.concat("\n") .concat("\t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t\t \t \t \t \t\t \t \t \t \t\t \t \t " + "\t \t \t \t \t\t \t \t \t \t ABSTRACT ESTIMATE") .concat("\n\n").concat("Name of Work: " + estimate.getName()).concat("\n") .concat("Description: " + estimate.getDescription()).concat("\n") .concat("Estimate Number: " + estimate.getEstimateNumber()).concat(oldEstNo)), false); hf.disableBorderSide(Rectangle.TOP); hf.disableBorderSide(Rectangle.BOTTOM); hf.setLeft(Element.ALIGN_LEFT); document.setHeader(hf); final PdfPTable overheadsTable = createOverheadsTable(estimate); document.add(spacer()); document.add(overheadsTable); document.add(spacer()); final PdfPTable multiyearTable = createMultiYearTable(estimate); document.add(makePara("Year-wise Estimate")); document.add(spacer()); document.add(multiyearTable); document.add(spacer()); document.add(makePara("Estimate Created By: " + estimate.getCreatedBy().getName())); document.add(spacer()); document.add(spacer()); document.add(makePara("Checked By: ")); document.newPage(); addZoneYearHeaderWithOutEstimateNo(estimate, estimateFinancialYear); document.add(createActivitiesTable(estimate)); document.add(spacer()); final PdfPTable approvaldetailsTable = createApprovalDetailsTable(estimate); // TODO:Fixme - commented final out workflow history final details since ordering final of approval is final not // getting final listed properly /* * if (approvaldetailsTable.getRows().size() != 1) { document.add(makePara("Approval Details")); * document.add(spacer()); document.add(approvaldetailsTable); } */ final String appropriationNumber = abstractEstimateService .getLatestEstimateAppropriationNumber(estimate); if (isSkipBudgetCheck()) { final PdfPTable depositWorksAppropriationTable = createDepositAppropriationTable(estimate, appropriationNumber); if (depositWorksAppropriationTable.getRows().size() != 1) if (appropriationNumber != null) { document.newPage(); document.add(spacer()); document.add(makePara("Deposit Code Appropriation Details")); document.add(spacer()); document.add(depositWorksAppropriationTable); } } else { final PdfPTable BudgetaryAppropriationTable = createBudgetaryAppropriationTable(estimate, appropriationNumber); final String estimateNumber = estimate.getEstimateNumber(); if (BudgetaryAppropriationTable.getRows().size() != 1) if (!getBudgetDetailUsage(estimateNumber).isEmpty() && appropriationNumber != null) { document.newPage(); document.add(spacer()); document.add(makePara("Budgetary Appropriation")); document.add(spacer()); document.add(BudgetaryAppropriationTable); } } document.newPage(); document.add(spacer()); document.add(makePara( "EXECUTIVE ENGINEER'S OFFICE, ZONE.......................................................................", Element.ALIGN_LEFT)); document.add(spacer()); document.add(makePara( "Est No. Unit: Dept.", Element.ALIGN_LEFT)); document.add(spacer()); final Paragraph budgetheadTextPara = new Paragraph( new Chunk("BUDGET HEAD", new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); budgetheadTextPara.setAlignment(Element.ALIGN_CENTER); document.add(budgetheadTextPara); document.add(spacer()); document.add(makePara("____________________________________________________________________________", Element.ALIGN_LEFT)); document.add(makePara("Rs. ", Element.ALIGN_LEFT)); document.add(makePara("____________________________________________________________________________", Element.ALIGN_LEFT)); document.add(makePara("Works: ", Element.ALIGN_LEFT)); document.add(spacer()); document.add(spacer()); final Paragraph memoTextPara = new Paragraph( new Chunk("MEMO", new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); memoTextPara.setAlignment(Element.ALIGN_CENTER); document.add(memoTextPara); document.add(makePara("Budget Grant ", Element.ALIGN_LEFT)); document.add(makePara("Amount Appropriated:__________________________________________________________", Element.ALIGN_LEFT)); document.add(makePara("Balance on Hand: ", Element.ALIGN_LEFT)); document.add( makePara("Amount of this estimate_________________________________________________________", Element.ALIGN_LEFT)); document.add(makePara("Balance forward_______________________________________________________________", Element.ALIGN_LEFT)); document.add( makePara("Submitted for favour of sanction ", Element.ALIGN_LEFT)); document.add(spacer()); document.add(spacer()); document.add( makePara("A.E.E.Unit " + space1 + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + "Exe.Eng.Zone.....................", Element.ALIGN_LEFT)); document.add(spacer()); document.add(makePara("Sanctioned", Element.ALIGN_CENTER)); document.add(spacer()); document.add(spacer()); document.add(makePara("DATE:" + space1 + "\t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t \t" + "Asst.Commissioner Zone...............", Element.ALIGN_LEFT)); document.add(spacer()); document.add(makePara( space1 + "\t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t \t" + "APPROPRIATION No.", Element.ALIGN_LEFT)); document.add(makePara(space1 + "\t \t \t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + "Date:", Element.ALIGN_LEFT)); // WF for signature ----- if (approvaldetailsTable.getRows().size() != 1) if (shouldShowApprovalNumber) { document.resetHeader(); document.newPage(); document.add( makePara("\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t\t \t \t \t \t\t \t \t \t \t\t \t \t " + "\t \t \t \t \t\t \t \t \t \t" + headerText.concat("\n").concat("\t \t \t \t \t \t \t \t \t \t" + "\t \t \t \t \t\t \t \t \t \t\t \t \t \t \t\t \t \t " + "\t \t \t \t \t\t \t \t \t \t ABSTRACT ESTIMATE") .concat("\n\n"))); document.add( makePara( "File Current Number :" + space1 + "\t \t \t \t \t \t \t \t \t \t \t \t \t " + "Date: \t \t", Element.ALIGN_LEFT)); document.add(makePara(space1 + "\t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t " + "Department : ", Element.ALIGN_LEFT)); document.add(spacer()); final Paragraph headingPara1 = new Paragraph( new Chunk("NOTE FOR ADMINISTRATIVE SANCTION AS PER RULE 78 OF ", new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); headingPara1.setAlignment(Element.ALIGN_CENTER); document.add(headingPara1); final Paragraph headingPara2 = new Paragraph( new Chunk("MCMC ACT 1919 ", new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); headingPara2.setAlignment(Element.ALIGN_CENTER); document.add(headingPara2); document.add(spacer()); final PdfPTable estimateDetailsTable1 = createEstimateDetailsTable1(estimate); document.add(estimateDetailsTable1); final PdfPTable budgetDetailsTableFourCols = createBudgetDetailsForEstimateTable(estimate); document.add(budgetDetailsTableFourCols); final PdfPTable estimateDetailsTable2 = createBalanceAmtCalculationTable(estimate); document.add(estimateDetailsTable2); document.add(spacer()); final Paragraph endTextPara = new Paragraph( new Chunk("** END **", new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); endTextPara.setAlignment(Element.ALIGN_CENTER); document.add(endTextPara); } document.close(); } catch (final DocumentException e) { throw new ApplicationRuntimeException("estimate.pdf.error", e); } }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createMultiYearTable(final AbstractEstimate estimate) throws DocumentException { final PdfPTable multiyearTable = new PdfPTable(3); multiyearTable.setWidthPercentage(100); multiyearTable.setWidths(new float[] { 1f, 2f, 2f }); addRow(multiyearTable, true, makePara("Sl No"), centerPara("Year"), centerPara("Percentage")); int i = 0;/*from w w w . j av a 2 s. c om*/ for (final MultiYearEstimate year : estimate.getMultiYearEstimates()) addRow(multiyearTable, true, makePara(++i), makePara(year.getFinancialYear().getFinYearRange(), Element.ALIGN_CENTER), rightPara(year.getPercentage())); return multiyearTable; }
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 {/*w ww .j a v a2 s.co m*/ // 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); } }