Example usage for com.lowagie.text Element ALIGN_LEFT

List of usage examples for com.lowagie.text Element ALIGN_LEFT

Introduction

In this page you can find the example usage for com.lowagie.text Element ALIGN_LEFT.

Prototype

int ALIGN_LEFT

To view the source code for com.lowagie.text Element ALIGN_LEFT.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:org.cgiar.ccafs.ap.summaries.projects.pdf.ProjectSummaryPDF.java

License:Open Source License

/**
 * Method used for to add the project summary
 *//*from   w  ww  .  j  a v a 2 s. com*/
private void addSummary() {
    Paragraph paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_LEFT);
    try {
        Phrase title = new Phrase(this.getText("summaries.project.summary"), BODY_TEXT_BOLD_FONT);
        paragraph.add(title);
        document.add(paragraph);

        paragraph = new Paragraph();
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        Phrase body = new Phrase(this.messageReturn(project.getSummary()), BODY_TEXT_FONT);
        paragraph.add(body);

        document.add(paragraph);

    } catch (DocumentException e) {
        LOG.error("There was an error trying to add the project summary to the project summary pdf", e);
    }
}

From source file:org.displaytag.render.ItextTableWriter.java

License:Artistic License

/**
 * Obtain the footer horizontal alignment; Meant to be overriden if a different style is desired.
 * @return The footer horizontal alignment.
 *///from   w  w  w . ja va2 s. co m
protected int getFooterHorizontalAlignment() {
    return Element.ALIGN_LEFT;
}

From source file:org.drools.verifier.doc.DroolsDocsComponentFactory.java

License:Apache License

public void onEndPage(PdfWriter writer, Document document) {

    try {//ww w. j a  v  a2 s .  c o  m
        Image image = Image.getInstance(DroolsDocsBuilder.class.getResource("guvnor-webapp.png")); // TODO this image never existed
        image.setAlignment(Image.RIGHT);
        image.scaleAbsolute(100, 30);
        Rectangle page = document.getPageSize();
        PdfPTable head = new PdfPTable(2);

        PdfPCell cell1 = new PdfPCell(image);
        cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell1.setBorder(0);

        head.addCell(cell1);

        PdfPCell cell2 = new PdfPCell(new Phrase(currentDate, DroolsDocsComponentFactory.HEADER_FOOTER_TEXT));
        cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell2.setBorder(0);

        head.addCell(cell2);

        head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        head.writeSelectedRows(0, -1, document.leftMargin(),
                page.getHeight() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent());

    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}

From source file:org.egov.infra.web.displaytag.export.EGovPdfView.java

License:Open Source License

protected int getCaptionHorizontalAlignment() {
    return Element.ALIGN_LEFT;
}

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);
    }/*from  ww w. j  av  a2s  .c om*/
    return contractorBillHeaderTable;
}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected PdfPTable createDeductionTypeDataTable() {
    final PdfPTable createcreateDeductionTypeDataTable = new PdfPTable(11);
    createcreateDeductionTypeDataTable.getDefaultCell().setBorderWidth(1);

    // statutory//from   ww w. j ava 2  s  .c om
    if (!sortedStatutorySortedList.isEmpty())
        for (final StatutoryDeductionsForBill egBillPayeedetail : sortedStatutorySortedList) {
            // get tot amt for dedcution for all bill for workorder till bill date
            final BigDecimal totStatutoryAmt = getTotStatoryAmountForDeduction(egBillPayeedetail);
            final String resultTotStatuAmt = getIntDecimalParts(totStatutoryAmt);
            final String[] resultTotStatuAry = resultTotStatuAmt.split(":");

            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            final String resultAmt = getIntDecimalParts(
                    egBillPayeedetail.getEgBillPayeeDtls().getCreditAmount());
            final String[] resultAry = resultAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
            createcreateDeductionTypeDataTable
                    .addCell(egBillPayeedetail.getEgBillPayeeDtls().getRecovery().getType());
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);
            createcreateDeductionTypeDataTable.addCell(resultTotStatuAry[0]);// Rs. amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultTotStatuAry[1]);// Pa, amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction specific to bill
            createcreateDeductionTypeDataTable.addCell(resultAry[1]);// pa. amt for this deduction specific to bill
        }
    final String type = "advanceAjustment";
    if ("advanceAjustment".equalsIgnoreCase(type)) {
        final BigDecimal totAmt = getTotAmountForAdvanceAdjustment();
        final String resultTotAmt = getIntDecimalParts(totAmt);
        final String[] resultTotAry = resultTotAmt.split(":");
        createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

        final String resultAmt = getIntDecimalParts(advanceAdjustment);
        final String[] resultAry = resultAmt.split(":");

        createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
        createcreateDeductionTypeDataTable.addCell("Advance adjustment ");
        createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);

        createcreateDeductionTypeDataTable.addCell(resultTotAry[0]);
        createcreateDeductionTypeDataTable.addCell(resultTotAry[1]);

        createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction specific to bill
        createcreateDeductionTypeDataTable.addCell(resultAry[1]);// pa. amt for this deduction specific to bill
    }

    // standard deduction
    if (!sortedStandardDeductionList.isEmpty())
        for (final DeductionTypeForBill deductionTypeForBill : sortedStandardDeductionList) {
            final BigDecimal totStandardAmt = getTotStandardAmountForDeduction(deductionTypeForBill);
            final String resultTotStandardAmt = getIntDecimalParts(totStandardAmt);
            final String[] resultTotStandardAry = resultTotStandardAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            final String resultAmt = getIntDecimalParts(deductionTypeForBill.getCreditamount());
            final String[] resultAry = resultAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
            createcreateDeductionTypeDataTable.addCell(deductionTypeForBill.getDeductionType());
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);
            createcreateDeductionTypeDataTable.addCell(resultTotStandardAry[0]);// Rs. amt all bill for workorder till
            // billdate
            createcreateDeductionTypeDataTable.addCell(resultTotStandardAry[1]);// Pa, amt all bill for workorder till
            // billdate
            createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction for this bill
            createcreateDeductionTypeDataTable.addCell(resultAry[1]);// Pa. amt for this deduction for this bill
        }

    if (!customDeductionList.isEmpty())
        for (final EgBilldetails egBilldetails : customDeductionList) {
            final BigDecimal totCustomAmt = getTotStandardAmountForDeduction(egBilldetails);
            final String resultTotCustomAmt = getIntDecimalParts(totCustomAmt);
            final String[] resultTotCustomAry = resultTotCustomAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            final String resultAmt = getIntDecimalParts(egBilldetails.getCreditamount());
            final String[] resultAry = resultAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
            createcreateDeductionTypeDataTable.addCell(chartOfAccountsHibernateDAO
                    .findById(Long.valueOf(egBilldetails.getGlcodeid().toString()), false).getName());
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);
            createcreateDeductionTypeDataTable.addCell(resultTotCustomAry[0]);// Rs. amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultTotCustomAry[1]);// Pa, amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultAry[0]); // amt for this deduction specific to bill
            createcreateDeductionTypeDataTable.addCell(resultAry[1]);
        }

    return createcreateDeductionTypeDataTable;
}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected PdfPTable createNetPayableTable() {
    final String resultAmt = getIntDecimalParts(netPayableAmount);
    final String[] resultAry = resultAmt.split(":");
    final PdfPTable createNetPayableData = new PdfPTable(11);
    createNetPayableData.getDefaultCell().setBorderWidth(1);
    createNetPayableData.getDefaultCell().setColspan(9);
    createNetPayableData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    createNetPayableData.addCell(makePara(
            pdfLabel.get("contractorbill.pdf.netamount") + ":\t" + getNetPayAmtInWords(), Font.UNDERLINE));
    createNetPayableData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    createNetPayableData.getDefaultCell().setColspan(1);
    createNetPayableData.addCell(resultAry[0]);
    createNetPayableData.addCell(resultAry[1]);
    return createNetPayableData;
}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected void createDetailsForWorkOrderData(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    contractorBillMainTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    if (!mbHeaderList.isEmpty()) {
        int listLen = 0;
        final int mbLen = mbHeaderList.size();
        int assetLen = 0;

        if (flag && assetForBillList.size() > mbHeaderList.size())
            listLen = assetForBillList.size();
        else/*from   w  ww.  ja v  a2 s  . c  o m*/
            listLen = mbHeaderList.size();

        if (flag)
            assetLen = assetForBillList.size();

        for (int i = 0; i < listLen; i++) {
            contractorBillMainTable.getDefaultCell().setColspan(2);
            if (i == 0)
                contractorBillMainTable.addCell(centerPara(projectCode));
            else
                contractorBillMainTable.addCell("");

            if (flag && i < assetLen)
                contractorBillMainTable.addCell(assetForBillList.get(i).getAsset().getCode() + "-"
                        + assetForBillList.get(i).getAsset().getName());
            else
                contractorBillMainTable.addCell("");
            contractorBillMainTable.getDefaultCell().setColspan(1);
            if (i < mbLen) {
                String mbRefNo = "";
                String mbFrmPgNo = "";
                String mbToPgNo = "";

                if (mbHeaderList.get(i).getMbRefNo() != null)
                    mbRefNo = mbHeaderList.get(i).getMbRefNo();

                if (mbHeaderList.get(i).getFromPageNo() != null)
                    mbFrmPgNo = mbHeaderList.get(i).getFromPageNo().toString();

                if (mbHeaderList.get(i).getToPageNo() != null)
                    mbToPgNo = mbHeaderList.get(i).getToPageNo().toString();

                contractorBillMainTable.addCell(centerPara("  " + mbRefNo));
                contractorBillMainTable.addCell(centerPara(blankSpace + mbFrmPgNo));
                contractorBillMainTable.addCell(centerPara(blankSpace + mbToPgNo));
            } else {
                contractorBillMainTable.addCell(centerPara(blankSpace));
                contractorBillMainTable.addCell(centerPara(blankSpace));
                contractorBillMainTable.addCell(centerPara(blankSpace));
            }
            contractorBillMainTable.getDefaultCell().setColspan(4);

            if (i == 0)
                contractorBillMainTable.addCell(makePara(
                        pdfLabel.get("contractorbill.pdf.estimateamt") + toCurrency(mbHeader
                                .getWorkOrderEstimate().getEstimate().getWorkValueIncludingTaxes().getValue()),
                        Element.ALIGN_LEFT));
            else
                contractorBillMainTable.addCell("");
        }
    }
}

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.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected PdfPTable createWorkDescTable() {
    final PdfPTable workDescTable = new PdfPTable(11);
    workDescTable.getDefaultCell().setBorderWidth(1);
    workDescTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    workDescTable.getDefaultCell().setColspan(7);
    workDescTable//from   ww w .  ja  v a2 s .  co  m
            .addCell(pdfLabel.get("contractorbill.pdf.workdescription") + newLine + workDescription + newLine);
    workDescTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    workDescTable.getDefaultCell().setColspan(4);
    workDescTable.addCell(pdfLabel.get("contractorbill.pdf.workcommencedon") + workcommencedOn + newLine
            + pdfLabel.get("contractorbill.pdf.workcompleteon") + workCompletedOn + newLine);
    return workDescTable;
}