Example usage for com.lowagie.text Font Font

List of usage examples for com.lowagie.text Font Font

Introduction

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

Prototype


public Font(int family, float size, int style) 

Source Link

Document

Constructs a Font.

Usage

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setBarra(int colSpan, float color) {
    PdfPCell celda = new PdfPCell(new Paragraph(" ", new Font(Font.HELVETICA, 1, Font.NORMAL)));
    celda.setGrayFill(color);//w w  w  . j a v a2 s.c om
    celda.setBorderWidth(0);
    celda.setPadding(0);
    celda.setColspan(colSpan);
    return celda;
}

From source file:jmemorize.core.io.PdfRtfBuilder.java

License:Open Source License

private static void writeCategoryHeader(Document doc, Category category) throws DocumentException {
    Chunk chunk = new Chunk(category.getPath());
    chunk.setFont(new Font(Font.HELVETICA, 12, Font.BOLD));

    Paragraph paragraph = new Paragraph(chunk);
    paragraph.setSpacingBefore(1f);//w ww  .jav  a  2 s .co m

    doc.add(paragraph);
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeTicketInfo(Document doc) throws Exception {
    Paragraph pg = new Paragraph("#" + tt.getUniqueId(), new Font(baseArial, 12, Font.BOLD));
    doc.add(pg);//from   w ww  . j  a v  a2  s .  c  om

    PdfPTable tb = new PdfPTable(1);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(5.0f);

    PdfPCell cl = new PdfPCell(new Phrase(tt.getName(), new Font(baseArial, 10, Font.BOLD)));

    tb.addCell(cl);

    if (clientPerson != null) {
        cl = new PdfPCell(new Phrase(
                "Prane: " + clientPerson.getName() + " (Telefono Nr: " + clientPerson.getPhoneNo() + ")",
                new Font(baseArial, 10)));
        tb.addCell(cl);
    }

    cl = new PdfPCell(new Phrase("Uduoties informacija: ", new Font(baseArial, 10)));
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase(tt.getDescription(), new Font(baseArial, 10)));

    tb.addCell(cl);

    doc.add(tb);
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeJobInfo(Document doc) throws Exception {

    Paragraph pg = new Paragraph("\nUDUOTIES ATLIKIMO INFORMACIJA", new Font(baseArial, 10, Font.BOLD));
    doc.add(pg);//from  ww w.j a  va 2  s.  c  o m

    PdfPTable tb = new PdfPTable(3);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(12.0f);
    tb.setWidths(new float[] { 6.0f, 84.0f, 10.0f });

    PdfPCell cl;

    doc.add(new Phrase("\nAtlikti darbai", new Font(baseArial, 12, Font.BOLD)));

    cl = new PdfPCell(new Phrase("Eil.nr", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);
    cl = new PdfPCell(new Phrase("Uduoties pavadinimas", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);
    cl = new PdfPCell(new Phrase("Valandos", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);

    doc.add(tb);

}

From source file:net.bull.javamelody.internal.web.pdf.PdfFonts.java

License:Apache License

private Font getChineseFont() {
    if (chineseFont == null) {
        try {//from  ww w.  java2 s.  c o  m
            BaseFont bfChinese;
            try {
                bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
            } catch (final DocumentException e) {
                // now CJKFont.propertiesLoaded==true, load properties renamed (cf issue 258)
                loadCJKFonts();
                bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
            }
            chineseFont = new Font(bfChinese, font.getSize(), font.getStyle());
        } catch (final DocumentException e) {
            throw new IllegalStateException(e);
        } catch (final IOException e) {
            throw new IllegalStateException(e);
        }
    }
    return chineseFont;
}

From source file:open.dolphin.client.AuditController.java

License:Open Source License

private void makePDF() {

    //- ?//from  w  w w. ja va  2 s .c o m
    Document doc = new Document(PageSize.A4, 20.0F, 20.0F, 40.0F, 40.0F);

    try {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String fileName = "_" + sdf.format(new java.util.Date()) + ".pdf";

        //()??
        FileOutputStream fos = new FileOutputStream(outputDir.getText() + fileName);
        PdfWriter pdfwriter = PdfWriter.getInstance(doc, fos);
        Font font_header = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 15.0F, 1);
        Font font_g11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F);
        Font font_g10 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 10.0F);
        //- ?
        Font font_m8 = new Font(BaseFont.createFont("HeiseiMin-W3", "UniJIS-UCS2-HW-H", false), 8.0F);
        Font font_underline_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F,
                4);
        Font font_red_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F);
        font_red_11.setColor(new Color(255, 0, 0));
        Font font_empty = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 9.0F);
        font_empty.setColor(new Color(255, 255, 255));

        Paragraph para_NF = new Paragraph(5, "\r\n",
                new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 13, Font.NORMAL));
        para_NF.setAlignment(Element.ALIGN_CENTER);

        // ??
        String author = Project.getProjectStub().getUserModel().getCommonName();
        doc.addAuthor(author);
        doc.addSubject("");

        HeaderFooter header = new HeaderFooter(new Phrase("", font_header),
                false);
        header.setAlignment(1);
        doc.setHeader(header);

        HeaderFooter footer = new HeaderFooter(new Phrase("--"), new Phrase("--"));
        footer.setAlignment(1);
        footer.setBorder(0);
        doc.setFooter(footer);

        doc.open();

        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy''MM''dd'' HH''mm''");
        String today = sdf1.format(new java.util.Date());
        Paragraph para_0 = new Paragraph("?" + today, font_g11);
        para_0.setAlignment(2);
        doc.add(para_0);
        Paragraph para_1 = new Paragraph("?" + author, font_g11);
        para_1.setAlignment(2);
        doc.add(para_1);
        doc.add(new Paragraph(""));
        // 
        doc.add(para_NF);
        doc.add(para_NF);

        for (int cnt = 0; cnt < outputList.size(); cnt++) {

            InnerBean bean = outputList.get(cnt);
            Person person = bean.getPerson();

            Paragraph para_2 = new Paragraph("ID" + person.idProperty().get(), font_underline_11);
            para_2.setAlignment(0);
            doc.add(para_2);
            Paragraph para_3 = new Paragraph("???" + person.nameProperty().get(),
                    font_underline_11);
            para_3.setAlignment(0);
            doc.add(para_3);
            Paragraph para_4 = new Paragraph("" + person.nameKanaProperty().get(),
                    font_underline_11);
            para_4.setAlignment(0);
            doc.add(para_4);
            Paragraph para_5 = new Paragraph("" + person.sexProperty().get(), font_underline_11);
            para_5.setAlignment(0);
            doc.add(para_5);
            Paragraph para_6 = new Paragraph("" + person.birthdayProperty().get(),
                    font_underline_11);
            para_6.setAlignment(0);
            doc.add(para_6);

            Table karteHistoryTable = new Table(5);
            karteHistoryTable.setWidth(100.0F);
            int[] uriage_table_width = { 25, 20, 30, 20, 25 };
            karteHistoryTable.setWidths(uriage_table_width);
            //karteHistoryTable.setDefaultHorizontalAlignment(1);
            //karteHistoryTable.setDefaultVerticalAlignment(5);
            karteHistoryTable.setPadding(3.0F);
            karteHistoryTable.setSpacing(0.0F);
            karteHistoryTable.setBorderColor(new Color(0, 0, 0));

            Cell cell_01 = new Cell(new Phrase("?", font_g10));
            cell_01.setGrayFill(0.8F);
            cell_01.setHorizontalAlignment(Element.ALIGN_CENTER);
            Cell cell_11 = new Cell(new Phrase("?", font_g10));
            cell_11.setGrayFill(0.8F);
            cell_11.setHorizontalAlignment(Element.ALIGN_CENTER);
            Cell cell_21 = new Cell(new Phrase("", font_g10));
            cell_21.setGrayFill(0.8F);
            cell_21.setHorizontalAlignment(Element.ALIGN_CENTER);
            Cell cell_31 = new Cell(new Phrase("", font_g10));
            cell_31.setGrayFill(0.8F);
            cell_31.setHorizontalAlignment(Element.ALIGN_CENTER);
            Cell cell_41 = new Cell(new Phrase("", font_g10));
            cell_41.setGrayFill(0.8F);
            cell_41.setHorizontalAlignment(Element.ALIGN_CENTER);

            karteHistoryTable.addCell(cell_01);
            karteHistoryTable.addCell(cell_11);
            karteHistoryTable.addCell(cell_21);
            karteHistoryTable.addCell(cell_31);
            karteHistoryTable.addCell(cell_41);

            List<KarteBean> list = bean.getResult();
            KarteBean karteInfo = list.get(0);
            List<DocInfoModel> docInfoList = karteInfo.getDocInfoList();

            //- ???
            int stepCount = 22;
            int tempCount = 0;
            int pageCount = 0;

            String firstKarteMaker = null;
            String karteMakeDate = null;
            if (docInfoList != null) {
                for (int i = 0; i < docInfoList.size(); ++i) {
                    DocInfoModel docInfo = docInfoList.get(i);
                    Cell cell = new Cell(new Phrase(docInfo.getFirstConfirmDateTime(), font_m8));
                    if (karteMakeDate == null || !karteMakeDate.equals(docInfo.getFirstConfirmDateTime())) {
                        karteMakeDate = docInfo.getFirstConfirmDateTime();
                        firstKarteMaker = docInfo.getPurpose();
                    }
                    cell.setHorizontalAlignment(0);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    karteHistoryTable.addCell(cell);
                    cell = new Cell(new Phrase(firstKarteMaker, font_m8));
                    cell.setHorizontalAlignment(0);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    karteHistoryTable.addCell(cell);
                    //- 
                    String addTitle = docInfo.getTitle();
                    addTitle = addTitle.replace("\r\n", "");
                    addTitle = addTitle.replace("\n", "");
                    cell = new Cell(new Phrase(addTitle, font_m8));
                    cell.setHorizontalAlignment(0);
                    karteHistoryTable.addCell(cell);
                    cell = new Cell(new Phrase(docInfo.getPurpose(), font_m8));
                    cell.setHorizontalAlignment(0);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    karteHistoryTable.addCell(cell);
                    cell = new Cell(new Phrase(docInfo.getConfirmDateTime(), font_m8));
                    cell.setHorizontalAlignment(0);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    karteHistoryTable.addCell(cell);

                    if (stepCount == tempCount) {
                        if (pageCount == 0) {
                            stepCount += 5;
                            pageCount++;
                        }
                        tempCount = 0;
                        doc.add(karteHistoryTable);
                        doc.newPage();
                        karteHistoryTable.deleteAllRows();
                        karteHistoryTable.addCell(cell_01);
                        karteHistoryTable.addCell(cell_11);
                        karteHistoryTable.addCell(cell_21);
                        karteHistoryTable.addCell(cell_31);
                        karteHistoryTable.addCell(cell_41);
                    } else {
                        tempCount++;
                    }
                }

                //                    Cell Empty_Cell = new Cell(new Phrase("empty", font_empty));
                //                    for (int i = docInfoList.size(); i < docInfoList.size() + 4; ++i) {
                //                        for (int j = 0; j < 4; ++j) {
                //                            karteHistoryTable.addCell(Empty_Cell);
                //                        }
                //                    }
                //
                //            Cell cell_goukei = new Cell(new Phrase("?", font_g10));
                //            cell_goukei.setGrayFill(0.8F);
                //            cell_goukei.setColspan(3);
                //            karteHistoryTable.addCell(cell_goukei);
                //            Cell cell_sum = new Cell(new Phrase("136,900", font_m10));
                //            cell_sum.setHorizontalAlignment(2);
                //            karteHistoryTable.addCell(cell_sum);
                doc.add(karteHistoryTable);
                doc.newPage();

            } else {
                // 
                doc.add(para_NF);

                Paragraph noData = new Paragraph("??", font_m8);
                noData.setAlignment(0);
                doc.add(noData);
                doc.newPage();
            }
        }
    } catch (DocumentException | IOException e) {
        Logger.getLogger(AuditController.class.getName()).log(Level.SEVERE, null, e);
    } finally {
        doc.close();
    }
}

From source file:org.caisi.tickler.web.TicklerPrinter.java

License:Open Source License

public void start() throws DocumentException, IOException {
    //Create the font we are going to print to
    bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
    font = new Font(bf, FONTSIZE, Font.NORMAL);
    boldFont = new Font(bf, FONTSIZE, Font.BOLD);

    document = new Document();
    writer = PdfWriterFactory.newInstance(document, os, FontSettings.HELVETICA_10PT);
    writer.setStrictImageSequence(true);

    document.setPageSize(PageSize.LETTER);
    document.open();//from  w  ww  .j  a v  a2  s  .c  om
}

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  w w  . jav  a  2  s  .  c o 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);
    }/*from w w w . j  a  v  a2  s  .  co  m*/
    return contractorBillHeaderTable;
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

public void generatePDF() {
    try {/*from   w w w. j a  v a  2s . c o  m*/
        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);
    }
}