Example usage for com.itextpdf.text Rectangle BOTTOM

List of usage examples for com.itextpdf.text Rectangle BOTTOM

Introduction

In this page you can find the example usage for com.itextpdf.text Rectangle BOTTOM.

Prototype

int BOTTOM

To view the source code for com.itextpdf.text Rectangle BOTTOM.

Click Source Link

Document

This represents one side of the border of the Rectangle.

Usage

From source file:com.maxl.java.amikodesk.SaveBasket.java

License:Open Source License

public PdfPTable getShoppingBasketForAuthor(Author a, PdfContentByte cb) {
    int position = 0;
    float subtotal_CHF = 0.0f;
    float shipping_CHF = 0.0f;
    float vat25_CHF = 0.0f;
    float vat80_CHF = 0.0f;

    String author = a.getShortName();

    BarcodeEAN codeEAN = new BarcodeEAN();

    // Pos | Menge | Eancode | Bezeichnung | MwSt | Preis
    PdfPTable table = new PdfPTable(new float[] { 1, 2, 3, 6, 1, 2 });
    table.setWidthPercentage(100f);//from  w w w.ja v a2s  . c  o m
    table.getDefaultCell().setPadding(5);
    table.setSpacingAfter(5f);

    PdfPCell cell = new PdfPCell();

    table.addCell(getStringCell(m_rb.getString("position"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("quantity"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("ean"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("article"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("vat"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_RIGHT, 1));
    table.addCell(getStringCell(m_rb.getString("price") + " (CHF)", font_bold_10,
            Rectangle.TOP | Rectangle.BOTTOM, Element.ALIGN_RIGHT, 1));

    if (m_shopping_basket.size() > 0 && !author.isEmpty()) {
        for (Map.Entry<String, Article> entry : m_shopping_basket.entrySet()) {
            Article article = entry.getValue();
            if (article.getAuthor().trim().toLowerCase().contains(author)) {
                String price_pruned = "";
                String total_price_CHF = "";
                if (article.getCode() != null && article.getCode().equals("ibsa")) {
                    float cr = article.getCashRebate();
                    if (article.getDraufgabe() > 0) {
                        price_pruned = String.format("%.2f", article.getBuyingPrice(0.0f));
                        total_price_CHF = String.format("%.2f", article.getTotBuyingPrice(0.0f));
                    } else {
                        price_pruned = String.format("%.2f", article.getBuyingPrice(cr));
                        total_price_CHF = String.format("%.2f", article.getTotBuyingPrice(cr));
                    }
                } else {
                    price_pruned = article.getCleanExfactoryPrice();
                    total_price_CHF = String.format("%.2f", article.getTotExfactoryPrice());
                }

                if (!price_pruned.isEmpty() && !price_pruned.equals("..")) {
                    // Index
                    table.addCell(getStringCell(Integer.toString(++position), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));
                    // Anzahl
                    table.addCell(getStringCell(Integer.toString(article.getQuantity()), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 1));
                    // EAN code
                    codeEAN.setCode(article.getEanCode());
                    Image img = codeEAN.createImageWithBarcode(cb, null, null);
                    img.scalePercent(120);
                    cell = new PdfPCell(img);
                    cell.setBorder(Rectangle.NO_BORDER);
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    cell.setUseBorderPadding(true);
                    cell.setBorderWidth(5);
                    if (position == 1)
                        cell.setPaddingTop(8);
                    else
                        cell.setPaddingTop(0);
                    cell.setPaddingBottom(8);
                    table.addCell(cell);
                    // Artikelbezeichnung
                    table.addCell(getStringCell(article.getPackTitle(), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));
                    // MwSt                  
                    table.addCell(getStringCell(String.format("%.1f%%", article.getVat()), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 1));
                    // Preis (exkl. MwSt)
                    // float price_CHF = article.getQuantity()*Float.parseFloat(price_pruned);
                    table.addCell(getStringCell(total_price_CHF, font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_RIGHT, 1));
                }
            }
        }

        subtotal_CHF = a.getSubtotal();
        shipping_CHF = a.getShippingCosts();
        vat25_CHF = a.getVat25();
        vat80_CHF = a.getVat80() + a.getShippingCosts() * 0.08f;

        float fulltotal_CHF = subtotal_CHF + shipping_CHF + vat25_CHF + vat80_CHF;

        table.addCell(getStringCell(m_rb.getString("subtotal"), font_bold_10, Rectangle.TOP,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, Rectangle.TOP, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", subtotal_CHF), font_bold_10, Rectangle.TOP,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("shipping"), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", shipping_CHF), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("vat") + " (2.5%)", font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", vat25_CHF), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("vat") + " (8.0%)", font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", vat80_CHF), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("gesamttotal"), font_bold_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", fulltotal_CHF), font_bold_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));
    }
    return table;
}

From source file:com.maxl.java.amikodesk.SaveBasket.java

License:Open Source License

public PdfPTable getFullShoppingBasket(PdfContentByte cb, String mode) {
    int position = 0;
    float sub_total_CHF = 0.0f;

    BarcodeEAN codeEAN = new BarcodeEAN();

    // Pos | Menge | Eancode | Bezeichnung | Preis
    PdfPTable table = new PdfPTable(new float[] { 1, 1, 3, 6, 2 });
    table.setWidthPercentage(100f);/*from  ww  w .  j a va2  s . com*/
    table.getDefaultCell().setPadding(5);
    table.setSpacingAfter(5f);

    PdfPCell cell = new PdfPCell();

    table.addCell(getStringCell(m_rb.getString("position"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("quantity"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("ean"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("article"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("price") + " (CHF)", font_bold_10,
            Rectangle.TOP | Rectangle.BOTTOM, Element.ALIGN_RIGHT, 1));

    if (m_shopping_basket.size() > 0) {
        for (Map.Entry<String, Article> entry : m_shopping_basket.entrySet()) {
            Article article = entry.getValue();

            if (mode.equals("all") || (mode.equals("rest") && (m_map_of_authors == null
                    || !anyElemIsContained(m_map_of_authors, article.getAuthor().trim().toLowerCase())))) {
                String price_pruned = "";
                if (article.getCode() != null && article.getCode().equals("ibsa")) {
                    float cr = article.getCashRebate();
                    if (article.getDraufgabe() > 0)
                        price_pruned = String.format("%.2f", article.getBuyingPrice(0.0f));
                    else
                        price_pruned = String.format("%.2f", article.getBuyingPrice(cr));
                } else {
                    price_pruned = article.getCleanExfactoryPrice();
                }

                if (!price_pruned.isEmpty() && !price_pruned.equals("..")) {
                    table.addCell(getStringCell(Integer.toString(++position), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));
                    table.addCell(getStringCell(Integer.toString(article.getQuantity()), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 1));

                    codeEAN.setCode(article.getEanCode());
                    Image img = codeEAN.createImageWithBarcode(cb, null, null);
                    img.scalePercent(120);
                    cell = new PdfPCell(img);
                    cell.setBorder(Rectangle.NO_BORDER);
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    cell.setUseBorderPadding(true);
                    cell.setBorderWidth(5);
                    if (position == 1)
                        cell.setPaddingTop(8);
                    else
                        cell.setPaddingTop(0);
                    cell.setPaddingBottom(8);
                    table.addCell(cell);

                    table.addCell(getStringCell(article.getPackTitle(), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));

                    float price_CHF = article.getQuantity() * Float.parseFloat(price_pruned);
                    sub_total_CHF += price_CHF;
                    table.addCell(getStringCell(String.format("%.2f", price_CHF), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 1));
                }
            }
        }

        table.addCell(getStringCell(m_rb.getString("subtotal"), font_bold_10, Rectangle.TOP,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, Rectangle.TOP, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", sub_total_CHF), font_bold_10, Rectangle.TOP,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("vat") + " (2.5%)", font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", sub_total_CHF * 0.025f), font_norm_10,
                PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("gesamttotal"), font_bold_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", sub_total_CHF * 1.025f), font_bold_10,
                PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 2));
    }
    return table;
}

From source file:com.norbsoft.pdfconverter.helpers.PDFHelper.java

License:Open Source License

private PdfPTable table(Form form) {
    int cellPadding = 5;
    PdfPTable table = new PdfPTable(8);
    table.setSpacingBefore(20);/* w w w. j a  va 2 s. c o m*/

    try {
        table.setWidths(new int[] { 100, 120, 30, 60, 60, 50, 50, 50 });
    } catch (DocumentException e) {
        Log.e(TAG, "Width error:" + e.getMessage());
    }

    PdfPCell cell = new PdfPCell(new Paragraph("Adres: " + form.getAddress(), normal));
    cell.setColspan(8);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Odbiorca: " + form.getOwner(), normal));
    cell.setColspan(8);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Data: " + form.getDate(), normal));
    cell.setColspan(3);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.LEFT | Rectangle.BOTTOM);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("tel: " + form.getPhone(), normal));
    cell.setColspan(5);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.RIGHT | Rectangle.BOTTOM);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    //Header
    Paragraph p = new Paragraph("WODOMIERZ", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setNoWrap(true);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Nr fabryczny", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("DN", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Typ\r\nProducent", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Stan w (m3)", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Rok\r\nlegalizacji", bold);
    cell = new PdfPCell(p);
    ;
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Czy plomba\r\nlegalizacyjna jest\r\nuszkodzona?", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //First row
    cell = new PdfPCell(new Paragraph("Zamontowany", bold));
    cell.setNoWrap(true);
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getNewSN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewDN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewType() + "\r\n" + form.getNewManufacturer(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewState(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewYear(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getNewSeal().equals("Tak"))
        p = new Paragraph("tak", normal);
    else
        p = new Paragraph("tak", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getNewSeal().equals("Nie"))
        p = new Paragraph("nie", normal);
    else
        p = new Paragraph("nie", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //Second row
    cell = new PdfPCell(new Paragraph("Wymontowany", bold));
    cell.setNoWrap(true);
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getOldSN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldDN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldType() + "\r\n" + form.getOldManufacturer(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldState(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldYear(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getOldSeal().equals("Tak"))
        p = new Paragraph("tak", normal);
    else
        p = new Paragraph("tak", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getOldSeal().equals("Nie"))
        p = new Paragraph("nie", normal);
    else
        p = new Paragraph("nie", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //Third row
    cell = new PdfPCell(new Paragraph("Plomba nr 1", bold));
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getSealFirst(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Przyczyna wymiany: " + form.getReason(), normal));
    cell.setPadding(cellPadding);
    cell.setColspan(5);
    table.addCell(cell);

    //Fourth row
    cell = new PdfPCell(new Paragraph("Plomba nr 2", bold));
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getSealSecond(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Umiejscowienie wodomierza: " + form.getPlacement(), normal));
    cell.setPadding(cellPadding);
    cell.setColspan(5);
    table.addCell(cell);

    //Fourth row
    cell = new PdfPCell(new Paragraph("Nr moduu\r\nradiowego", bold));
    cell.setPadding(cellPadding);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(form.getNewModuleNumber(), normal));
    cell.setPadding(cellPadding);
    cell.setColspan(7);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    table.setWidthPercentage(100);
    return table;
}

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 {//from   w  w w . j a v  a  2s .c o 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 {//  w w  w . jav  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.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 w  w .  java2  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.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 {//w w w.ja va2 s . com

        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 {// w  w w.  j a v a2s .  com

        /*  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 2 s. 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;
}

From source file:com.softwaremagico.tm.pdf.complete.skills.MainSkillsTableFactory.java

License:Open Source License

public static PdfPTable getSkillsTable(CharacterPlayer characterPlayer, String language)
        throws InvalidXmlElementException {
    float[] widths = { 1f, 12f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from   w  w  w. j a va 2  s. c  o m*/

    PdfPCell separator = createSeparator();
    separator.setPadding(PADDING);
    table.addCell(separator);
    table.addCell(separator);
    table.addCell(separator);

    PdfPCell vitalityCell = new PdfPCell(new VitalityTable(characterPlayer));
    vitalityCell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT);
    vitalityCell.setPadding(0);
    table.addCell(vitalityCell);

    PdfPCell skillsCell = new PdfPCell(CompleteSkillsTable.getSkillsTable(characterPlayer, language));
    skillsCell.setBorder(0);
    skillsCell.setPadding(0);
    skillsCell.setPaddingRight(FadingSunsTheme.DEFAULT_MARGIN);
    skillsCell.setPaddingLeft(FadingSunsTheme.DEFAULT_MARGIN);
    table.addCell(skillsCell);

    PdfPCell wyrdCell = new PdfPCell(new WyrdTable(characterPlayer));
    wyrdCell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT);
    wyrdCell.setPadding(0);
    table.addCell(wyrdCell);
    return table;
}