Example usage for com.lowagie.text Cell Cell

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

Introduction

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

Prototype

public Cell() 

Source Link

Document

Constructs an empty Cell.

Usage

From source file:br.edu.ifrs.restinga.sgru.modelo.ControladorVenda.java

/**
 * Realiza a venda de um ticket para um cliente
 *
 * @param documento//from  w  w  w. j  a v a 2s  . c  o m
 * @throws br.edu.ifrs.restinga.sgru.excessao.TicketInvalidoException
 */
//public void realizarVendaTicket(Object documento) throws TicketInvalidoException {
public void realizarVendaTicket() throws TicketInvalidoException {
    if (this.quantidade <= 0) {
        throw new TicketInvalidoException("Venda de Quantidade invalida!");
    }

    Document pdfTicket = new Document();
    File temp;

    try {
        temp = File.createTempFile("imp_ticket", ".pdf");
        PdfWriter.getInstance(pdfTicket, new FileOutputStream(temp));
        pdfTicket.open();
        pdfTicket.setPageSize(PageSize.A4);

        Table tabela = new Table(1);
        tabela.setWidth(100);

        for (int i = 0; i < this.quantidade; i++) {
            VendaTicketsRecargas vendaTicketsRecarga = new VendaTicketsRecargas();
            vendaTicketsRecarga.setCaixaRU(this.caixaRU);
            vendaTicketsRecarga.realizarVendaTicket();

            Cell celula = new Cell();
            celula.setHorizontalAlignment(Element.ALIGN_CENTER);
            celula.add(new Paragraph("SISTEMA DE GERENCIAMENTO DE RESTAURANTE UNIVERSIT?RIO"));

            Paragraph parag = new Paragraph();
            parag.getFont().setSize(18);
            parag.add("TICKET");
            celula.add(parag);

            // Gerando o codigo convetido do ticket
            String conversor = "";
            for (char con : String.format("%07d", vendaTicketsRecarga.getTicket().getId()).toCharArray()) {
                conversor = con + conversor;
            }

            parag = new Paragraph();
            parag.getFont().setSize(20);
            parag.add(String.valueOf(Integer.valueOf(conversor, 16)));
            celula.add(parag);

            NumberFormat format = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
            format.setMaximumFractionDigits(2);
            celula.add(new Paragraph("VALOR " + format.format(vendaTicketsRecarga.getTicket().getValor())));
            celula.add(new Paragraph(vendaTicketsRecarga.getTicket().getDataCriado().getTime().toString()));
            celula.add(new Paragraph(" _ "));
            tabela.addCell(celula);

            this.caixaRU.atualizarLstVendaTicketsRecargas(vendaTicketsRecarga);
        }

        pdfTicket.add(tabela);
    } catch (DocumentException | IOException de) {
        throw new TicketInvalidoException(de.getMessage());
    } finally {
        pdfTicket.close();
    }

    // Abrindo o pdf no pc
    try {
        Desktop.getDesktop().open(temp);
        temp.deleteOnExit();
    } catch (IOException ex) {
        throw new TicketInvalidoException(ex.getMessage());
    }
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

/**
 * @author sunqichang///from w ww .  ja v  a2 s .com
 * @param filename
 *            
 * @param type
 *            pdfdoc
 */
public void createReport_hardwareNew(String filename, String type) {
    try {
        int diskcount = Integer.parseInt(request.getParameter("diskcount"));
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");
        List networkList = (List) reportHash.get("networkList");
        List serverList = (List) reportHash.get("serverList");
        List dbList = (List) reportHash.get("dbList");
        List midwareList = (List) reportHash.get("midwareList");
        Document document = new Document(PageSize.A4);
        if ("doc".equalsIgnoreCase(type)) {
            RtfWriter2.getInstance(document, new FileOutputStream(filename));
        } else {
            PdfWriter.getInstance(document, new FileOutputStream(filename));
        }
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font fontChineseTitle = new Font(bfChinese, 14, Font.BOLD);
        Font fontChineseRow = new Font(bfChinese, 12, Font.NORMAL);
        fileName = filename;
        document.open();
        Paragraph title = new Paragraph("", fontChineseTitle);
        title.setAlignment(Element.ALIGN_CENTER);
        document.add(title);
        String contextString = ":" + impReport.getTimeStamp() + " \n"// 
                + ":" + starttime + "  " + totime;
        Paragraph context = new Paragraph(contextString, fontChineseTitle);
        context.setAlignment(Element.ALIGN_CENTER);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        Iterator networkIt = null;
        if (networkList != null) {
            networkIt = networkList.iterator();
        }
        Iterator serverIt = null;
        if (serverList != null) {
            serverIt = serverList.iterator();
        }
        Iterator dbIt = null;
        if (dbList != null) {
            dbIt = dbList.iterator();
        }
        Iterator midwareIt = null;
        if (midwareList != null) {
            midwareIt = midwareList.iterator();
        }
        String[] networkTitle = { "", "", "", "", "IP", "" };
        String[] serverTitle = { "", "", "", "", "IP", "", "" };
        String[] dbTitle = { "", "", "", "IP" };
        String[] midwareTitle = { "", "", "", "IP" };
        Table table = new Table(9);
        table.setWidth(100);
        table.setAlignment(Element.ALIGN_CENTER);// 
        table.setAutoFillEmptyCells(true); // 
        table.setBorderWidth(1); // 
        table.setBorderColor(new Color(0, 125, 255)); // 
        table.setPadding(2);// 
        table.setSpacing(0);// 
        table.setBorder(2);// 
        for (int i = 0; i < networkTitle.length; i++) {
            Cell cell = new Cell();
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.addElement(new Paragraph(networkTitle[i], fontChineseTitle));
            if (i == 0) {
                cell.setRowspan(networkList.size() + 1);
            }
            if (i == 1 || i == 4 || i == 3) {
                cell.setColspan(2);
            }
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(cell);
        }
        if (networkIt != null) {
            while (networkIt.hasNext()) {
                Cell cell1 = new Cell();
                Cell cell2 = new Cell();
                Cell cell3 = new Cell();
                Cell cell4 = new Cell();
                Cell cell5 = new Cell();
                cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
                MonitorNodeDTO monitorNodeDTO = (MonitorNodeDTO) networkIt.next();
                cell1.addElement(new Paragraph(monitorNodeDTO.getAlias(), fontChineseRow));
                cell2.addElement(new Paragraph(monitorNodeDTO.getCategory(), fontChineseRow));
                cell3.addElement(new Paragraph(monitorNodeDTO.getType(), fontChineseRow));
                cell4.addElement(new Paragraph(monitorNodeDTO.getIpAddress(), fontChineseRow));
                cell5.addElement(
                        new Paragraph(String.valueOf(monitorNodeDTO.getEntityNumber()), fontChineseRow));
                cell1.setColspan(2);
                // cell2.setColspan(2);
                cell3.setColspan(2);
                cell4.setColspan(2);
                // cell5.setColspan(2);
                table.addCell(cell1);
                table.addCell(cell2);
                table.addCell(cell3);
                table.addCell(cell4);
                table.addCell(cell5);
            }
        }
        for (int i = 0; i < serverTitle.length; i++) {
            Cell cell = new Cell();
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.addElement(new Paragraph(serverTitle[i], fontChineseTitle));
            if (i == 0) {
                cell.setRowspan(diskcount + 1 + serverList.size());
            }
            if (i == 5 || i == 6) {
                cell.setColspan(2);
            }
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(cell);
        }
        if (serverIt != null) {
            while (serverIt.hasNext()) {
                Cell cell1 = new Cell();
                Cell cell2 = new Cell();
                Cell cell3 = new Cell();
                Cell cell44 = new Cell();
                cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell44.setVerticalAlignment(Element.ALIGN_MIDDLE);
                MonitorNodeDTO monitorNodeDTO = (MonitorNodeDTO) serverIt.next();
                AssetHelper helper = new AssetHelper();
                List<StatisNumer> diskList = helper.getAssetList(monitorNodeDTO.getIpAddress(), "Disk");
                List<StatisNumer> memList = helper.getAssetList(monitorNodeDTO.getIpAddress(), "Memory");
                cell1.addElement(new Paragraph(monitorNodeDTO.getAlias(), fontChineseRow));
                cell2.addElement(new Paragraph(monitorNodeDTO.getCategory(), fontChineseRow));
                cell3.addElement(new Paragraph(monitorNodeDTO.getType(), fontChineseRow));
                cell44.addElement(new Paragraph(monitorNodeDTO.getIpAddress(), fontChineseRow));
                cell1.setRowspan(diskList.size() + 2);
                cell2.setRowspan(diskList.size() + 2);
                cell3.setRowspan(diskList.size() + 2);
                cell44.setRowspan(diskList.size() + 2);
                table.addCell(cell1);
                table.addCell(cell2);
                table.addCell(cell3);
                table.addCell(cell44);
                Iterator<StatisNumer> diskIt = diskList.iterator();
                int flag = 0;
                int rowspan = diskList.size() + 2;
                double sum = 0;
                while (diskIt.hasNext()) {
                    if (flag == 0 || flag == rowspan / 2) {
                        if (flag == 0) {
                            Cell cellt1 = new Cell();
                            Cell cellt2 = new Cell();
                            cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
                            cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
                            cellt1.add(new Paragraph("", fontChineseRow));
                            cellt2.add(new Paragraph("", fontChineseRow));
                            table.addCell(cellt1);
                            table.addCell(cellt2);
                        }
                        Iterator<StatisNumer> memIt = memList.iterator();
                        while (memIt.hasNext()) {
                            StatisNumer numer = memIt.next();
                            if (flag == rowspan / 2) {
                                flag++;
                                continue;
                            }
                            Cell cell6 = new Cell();
                            Cell cell7 = new Cell();
                            cell6.setVerticalAlignment(Element.ALIGN_MIDDLE);
                            cell7.setVerticalAlignment(Element.ALIGN_MIDDLE);
                            cell6.addElement(new Paragraph(numer.getName(), fontChineseRow));
                            cell7.addElement(new Paragraph(numer.getCurrent(), fontChineseRow));
                            if (flag == 0) {
                                cell6.setRowspan(rowspan / 2);
                                cell7.setRowspan(rowspan / 2);
                                table.addCell(cell6);
                                table.addCell(cell7);
                                break;
                            } else {
                                cell6.setRowspan(rowspan - rowspan / 2);
                                cell7.setRowspan(rowspan - rowspan / 2);
                                table.addCell(cell6);
                                table.addCell(cell7);
                            }
                        }
                    }
                    Cell cell4 = new Cell();
                    Cell cell5 = new Cell();
                    cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    StatisNumer numer = diskIt.next();
                    cell4.addElement(new Paragraph(numer.getName(), fontChineseRow));
                    cell5.addElement(new Paragraph(numer.getCurrent(), fontChineseRow));
                    table.addCell(cell4);
                    table.addCell(cell5);
                    sum = Arith.add(sum, Double.parseDouble(numer.getCurrent().replaceAll("[a-zA-Z]", "")));
                    flag++;
                }
                Cell cell6 = new Cell();
                Cell cell7 = new Cell();
                cell6.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell7.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell6.addElement(new Paragraph("", fontChineseRow));
                cell7.addElement(new Paragraph(Arith.round(sum, 2) + "G", fontChineseRow));
                table.addCell(cell6);
                table.addCell(cell7);
            }
        }
        for (int i = 0; i < dbTitle.length; i++) {
            Cell cell = new Cell();
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.addElement(new Paragraph(dbTitle[i], fontChineseTitle));
            if (i == 0) {
                cell.setRowspan(dbList.size() + 1);
            }
            if (i == 3) {
                cell.setColspan(4);
            } else if (i != 0) {
                cell.setColspan(2);
            }
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(cell);
        }
        if (dbIt != null) {
            while (dbIt.hasNext()) {
                Cell cell2 = new Cell();
                Cell cell3 = new Cell();
                Cell cell4 = new Cell();
                cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);
                MonitorDBDTO monitorNodeDTO = (MonitorDBDTO) dbIt.next();
                cell2.addElement(new Paragraph(monitorNodeDTO.getAlias(), fontChineseRow));
                cell3.addElement(new Paragraph(monitorNodeDTO.getDbtype(), fontChineseRow));
                cell4.addElement(new Paragraph(monitorNodeDTO.getIpAddress(), fontChineseRow));
                cell2.setColspan(2);
                cell3.setColspan(2);
                cell4.setColspan(4);
                table.addCell(cell2);
                table.addCell(cell3);
                table.addCell(cell4);
            }
        }
        for (int i = 0; i < midwareTitle.length; i++) {
            Cell cell = new Cell();
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.addElement(new Paragraph(midwareTitle[i], fontChineseTitle));
            if (i == 0) {
                cell.setRowspan(midwareList.size() + 1);
            }
            if (i == 3) {
                cell.setColspan(4);
            } else if (i != 0) {
                cell.setColspan(2);
            }
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(cell);
        }
        if (midwareIt != null) {
            while (midwareIt.hasNext()) {
                Cell cell2 = new Cell();
                Cell cell3 = new Cell();
                Cell cell4 = new Cell();
                cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);
                MonitorMiddlewareDTO monitorNodeDTO = (MonitorMiddlewareDTO) midwareIt.next();
                cell2.addElement(new Paragraph(monitorNodeDTO.getAlias(), fontChineseRow));
                cell3.addElement(new Paragraph(monitorNodeDTO.getCategory(), fontChineseRow));
                cell4.addElement(new Paragraph(monitorNodeDTO.getIpAddress(), fontChineseRow));
                cell2.setColspan(2);
                cell3.setColspan(2);
                cell4.setColspan(4);
                table.addCell(cell2);
                table.addCell(cell3);
                table.addCell(cell4);
            }
        }
        document.add(table);
        document.close();
    } catch (Exception e) {
        SysLogger.error("", e);
    }
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_hostDoc(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*  ww  w  .  j  ava 2s  .  co  m*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    Calendar colTime = (Calendar) reportHash.get("time");
    Date cc = colTime.getTime();
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable Disk = (Hashtable) reportHash.get("Disk");

    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash");
    Hashtable maxping = (Hashtable) reportHash.get("ping");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    RtfWriter2.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, titleFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(4);
    float[] widths = { 220f, 300f, 220f, 220f };
    aTable.setWidths(widths);
    aTable.setWidth(100); //  90%
    aTable.setAlignment(Element.ALIGN_CENTER);// 
    aTable.setAutoFillEmptyCells(true); // 
    aTable.setBorderWidth(1); // 
    aTable.setBorderColor(new Color(0, 125, 255)); // 
    aTable.setPadding(2);// 
    aTable.setSpacing(0);// 
    aTable.setBorder(2);// 
    aTable.endHeaders();
    Cell cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(cell);
    aTable.addCell(Ping + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "ConnectUtilization" + ".png");
    img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.LEFT);// 
    document.add(aTable);
    document.add(img);

    String cpu = "";
    if (CPU.get("cpu") != null)
        cpu = (String) CPU.get("cpu");
    String cpumax = "";
    if (CPU.get("cpumax") != null)
        cpumax = (String) CPU.get("cpumax");
    String avgcpu = "";
    if (CPU.get("avgcpu") != null)
        avgcpu = (String) CPU.get("avgcpu");
    Table aTable1 = new Table(4);
    float[] width = { 220f, 300f, 220f, 220f };
    aTable1.setWidths(width);
    aTable1.setWidth(100); //  90%
    aTable1.setAlignment(Element.ALIGN_CENTER);// 
    aTable1.setAutoFillEmptyCells(true); // 
    aTable1.setBorderWidth(1); // 
    aTable1.setBorderColor(new Color(0, 125, 255)); // 
    aTable1.setPadding(2);// 
    aTable1.setSpacing(0);// 
    aTable1.setBorder(2);// 
    aTable1.endHeaders();

    cell = new Cell();
    cell.addElement(new Paragraph("CPU", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable1.addCell(cell);

    aTable1.addCell(cpu + "%");
    aTable1.addCell(cpumax);
    aTable1.addCell(avgcpu);

    Image img1 = Image.getInstance(
            ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "cpu" + ".png");
    img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.MIDDLE);// 
    document.add(aTable1);
    document.add(img1);

    if (Memory != null && Memory.size() > 0) {
        Table aTable2 = new Table(6);
        float[] widthss = { 220f, 300f, 220f, 220f, 220f, 220f };
        aTable2.setWidths(widthss);
        aTable2.setWidth(100); //  90%
        aTable2.setAlignment(Element.ALIGN_CENTER);// 
        aTable2.setAutoFillEmptyCells(true); // 
        aTable2.setBorderWidth(1); // 
        aTable2.setBorderColor(new Color(0, 125, 255)); // 
        aTable2.setPadding(2);// 
        aTable2.setSpacing(0);// 
        aTable2.setBorder(2);// 
        aTable2.endHeaders();
        cell = new Cell("");
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable2.addCell(cell);
        cell = new Cell("");
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable2.addCell(cell);
        // 

        for (int i = 0; i < memoryItemch.length; i++) {
            cell = new Cell(memoryItemch[i]);
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            // cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            aTable2.addCell(cell);
        }
        // 
        for (int i = 0; i < Memory.size(); i++) {
            aTable2.addCell("");
            Hashtable mhash = (Hashtable) (Memory.get(new Integer(i)));
            String name = (String) mhash.get("name");
            Cell cell1 = new Cell(name);
            aTable2.addCell(cell1);
            for (int j = 0; j < memoryItem.length; j++) {
                String value = "";
                if (mhash.get(memoryItem[j]) != null) {
                    value = (String) mhash.get(memoryItem[j]);
                }
                Cell cell2 = new Cell(value);
                aTable2.addCell(cell2);
            }
            String value = "";
            if (memMaxHash.get(name) != null) {
                value = (String) memMaxHash.get(name);
                Cell cell3 = new Cell(value);
                aTable2.addCell(cell3);
            }
            String avgvalue = "";
            if (memAvgHash.get(name) != null) {
                avgvalue = (String) memAvgHash.get(name);
                aTable2.addCell(avgvalue);
            }

        } // end 
          // 
        Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "memory" + ".png");
        img.setAbsolutePosition(0, 0);
        img.setAlignment(Image.MIDDLE);// 
        document.add(aTable2);
        document.add(img2);
    } else {
        Table aTable2 = new Table(6);
        float[] widthss = { 220f, 300f, 220f, 220f, 220f, 220f };
        aTable2.setWidths(widthss);
        aTable2.setWidth(100); //  90%
        aTable2.setAlignment(Element.ALIGN_CENTER);// 
        aTable2.setAutoFillEmptyCells(true); // 
        aTable2.setBorderWidth(1); // 
        aTable2.setBorderColor(new Color(0, 125, 255)); // 
        aTable2.setPadding(2);// 
        aTable2.setSpacing(0);// 
        aTable2.setBorder(2);// 
        aTable2.endHeaders();
        cell = new Cell("");
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable2.addCell(cell);
        cell = new Cell("");
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable2.addCell(cell);
        // 

        for (int i = 0; i < memoryItemch.length; i++) {
            cell = new Cell(memoryItemch[i]);
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            aTable2.addCell(cell);
        }
        // 
        String[] names = null;
        HostNodeDao dao = new HostNodeDao();
        HostNode node = (HostNode) dao.findByCondition("ip_address", ip).get(0);
        // Monitoriplist monitor = monitorManager.getByIpaddress(ip);
        if (node.getSysOid().startsWith("1.3.6.1.4.1.311")) {
            names = new String[] { "PhysicalMemory", "VirtualMemory" };
        } else {
            names = new String[] { "PhysicalMemory", "SwapMemory" };
        }
        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            aTable2.addCell("");
            cell = new Cell(names[i]);
            aTable2.addCell(cell);

            for (int j = 0; j < memoryItem.length; j++) {
                // 
                String value = "";
                Cell cell1 = new Cell(value);
                aTable2.addCell(cell1);
            }
            String value = "";
            if (memMaxHash.get(name) != null) {
                value = (String) memMaxHash.get(name);
                Cell cell2 = new Cell(value);
                aTable2.addCell(cell2);
            } else {
                Cell cell3 = new Cell(value);
                aTable2.addCell(cell3);
            }
            String avgvalue = "";
            if (memAvgHash.get(name) != null) {
                avgvalue = (String) memAvgHash.get(name);
                Cell cell4 = new Cell(avgvalue);
                aTable2.addCell(cell4);
            } else {
                Cell cell5 = new Cell(avgvalue);
                aTable2.addCell(cell5);
            }

        } // end 
          // 
        Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "memory" + ".png");
        img.setAbsolutePosition(0, 0);
        img.setAlignment(Image.MIDDLE);// 
        document.add(aTable2);
        document.add(img2);

    }
    Table aTable3 = new Table(5);
    float[] widthss1 = { 220f, 440f, 150f, 150f, 220f };
    aTable3.setWidths(widthss1);
    aTable3.setWidth(100); //  90%
    aTable3.setAlignment(Element.ALIGN_CENTER);// 
    aTable3.setAutoFillEmptyCells(true); // 
    aTable3.setBorderWidth(1); // 
    aTable3.setBorderColor(new Color(0, 125, 255)); // 
    aTable3.setPadding(2);// 
    aTable3.setSpacing(0);// 
    aTable3.setBorder(2);// 
    aTable3.endHeaders();
    if (Disk != null && Disk.size() > 0) {
        cell = new Cell("");
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable3.addCell(cell);
        cell = new Cell("");
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable3.addCell(cell);

        for (int i = 0; i < diskItemch.length; i++) {
            cell = new Cell(diskItemch[i]);
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            aTable3.addCell(cell);
        }
        // 

        for (int i = 0; i < Disk.size(); i++) {
            aTable3.addCell("");
            Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i)));
            String name = (String) diskhash.get("name");
            cell = new Cell(name);
            aTable3.addCell(cell);
            for (int j = 0; j < diskItem.length; j++) {
                String value = "";
                if (diskhash.get(diskItem[j]) != null) {
                    value = (String) diskhash.get(diskItem[j]);
                }
                Cell cell1 = new Cell(value);
                // System.out.println(value+"================value===============");
                aTable3.addCell(cell1);
            }
        } // end 
          // 
        Image img3 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "disk" + ".png");
        img.setAbsolutePosition(0, 0);
        img.setAlignment(Image.MIDDLE);// 
        document.add(aTable3);
        document.add(img3);

    }
    if (impReport.getChart() != null) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                    impReport.getChart().getWidth(), impReport.getChart().getHeight());
        } catch (IOException ioe) {
        }
        Image img3 = Image.getInstance(baos.toByteArray());
        img.setAbsolutePosition(0, 0);
        img.setAlignment(Image.MIDDLE);// 

        document.add(img3);
    }
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_hostPDF(String file) throws DocumentException, IOException {

    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*ww w .  java  2 s. c  o m*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    Calendar colTime = (Calendar) reportHash.get("time");
    Date cc = colTime.getTime();
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable Disk = (Hashtable) reportHash.get("Disk");

    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash");
    Hashtable maxping = (Hashtable) reportHash.get("ping");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);

    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Phrase("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(4);
    aTable.setAutoFillEmptyCells(true);
    aTable.setWidth(100);
    // float[] widths = { 220f, 300f, 220f, 220f };
    // aTable.setWidths(widths);
    aTable.setPadding(5);
    // aTable.setWidthPercentage(100);

    Cell cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(cell);
    aTable.addCell(Ping + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "ConnectUtilization" + ".png");

    img.setAlignment(Image.LEFT);// 
    img.scalePercent(75);
    document.add(aTable);
    document.add(img);

    String cpu = "";
    if (CPU.get("cpu") != null)
        cpu = (String) CPU.get("cpu");
    String cpumax = "";
    if (CPU.get("cpumax") != null)
        cpumax = (String) CPU.get("cpumax");
    String avgcpu = "";
    if (CPU.get("avgcpu") != null)
        avgcpu = (String) CPU.get("avgcpu");
    Table aTable1 = new Table(4);
    aTable1.setAutoFillEmptyCells(true);
    aTable1.setWidth(100);
    aTable1.setPadding(5);
    // float[] width = { 220f, 300f, 220f, 220f };
    // aTable1.setWidths(width);
    // aTable1.setWidthPercentage(100);

    cell = new Cell();
    cell.addElement(new Paragraph("CPU", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable1.addCell(cell);
    cell = new Cell();
    cell.addElement(new Paragraph("", contextFont));
    cell.setBackgroundColor(Color.LIGHT_GRAY);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    aTable1.addCell(cell);

    aTable1.addCell(cpu + "%");
    aTable1.addCell(cpumax);
    aTable1.addCell(avgcpu);

    Image img1 = Image.getInstance(
            ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "cpu" + ".png");
    img.setAlignment(Image.MIDDLE);// 
    img1.scalePercent(75);
    document.add(aTable1);
    document.add(img1);

    if (Memory != null && Memory.size() > 0) {
        Table aTable2 = new Table(6);
        aTable2.setPadding(5);
        aTable2.setAutoFillEmptyCells(true);
        aTable2.setWidth(100);
        // float[] widthss = { 220f, 300f, 220f, 220f, 220f, 220f };
        // aTable2.setWidths(widthss);
        // aTable2.setWidthPercentage(100);
        cell = new Cell(new Phrase("", contextFont));
        cell.setBackgroundColor(Color.LIGHT_GRAY);

        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        aTable2.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));

        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable2.addCell(cell);
        // 

        for (int i = 0; i < memoryItemch.length; i++) {
            cell = new Cell(new Phrase(memoryItemch[i], contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            aTable2.addCell(cell);
        }
        // 
        for (int i = 0; i < Memory.size(); i++) {
            aTable2.addCell("");
            Hashtable mhash = (Hashtable) (Memory.get(new Integer(i)));
            String name = (String) mhash.get("name");
            cell = new Cell(new Phrase(name));

            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            aTable2.addCell(cell);
            for (int j = 0; j < memoryItem.length; j++) {
                String value = "";
                if (mhash.get(memoryItem[j]) != null) {
                    value = (String) mhash.get(memoryItem[j]);
                }
                cell = new Cell(new Phrase(value));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell);
            }
            String value = "";
            if (memMaxHash.get(name) != null) {
                value = (String) memMaxHash.get(name);
                Cell cell3 = new Cell(new Phrase(value));
                cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell3);
            }
            String avgvalue = "";
            if (memAvgHash.get(name) != null) {
                avgvalue = (String) memAvgHash.get(name);
                cell = new Cell(new Phrase(avgvalue));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell);
            }

        } // end 
          // 
        Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "memory" + ".png");
        img.setAlignment(Image.MIDDLE);// 
        img2.scalePercent(75);
        document.add(aTable2);
        document.add(img2);
    } else {
        Table aTable2 = new Table(6);

        float[] widthss = { 220f, 300f, 220f, 220f, 220f, 220f };
        aTable2.setWidths(widthss);
        // aTable2.setWidthPercentage(100);
        /*
         * aTable2.setWidth(100); //  90%
         * aTable2.setAlignment(Element.ALIGN_CENTER);// 
         * aTable2.setAutoFillEmptyCells(true); // 
         * aTable2.setBorderWidth(1); //  aTable2.setBorderColor(new
         * Color(0, 125, 255)); //  aTable2.setPadding(2);//
         *  aTable2.setSpacing(0);// 
         * aTable2.setBorder(2);//  aTable2.endHeaders();
         */
        cell = new Cell(new Phrase("", contextFont));
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        aTable2.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable2.addCell(cell);
        // 

        for (int i = 0; i < memoryItemch.length; i++) {
            cell = new Cell(new Phrase(memoryItemch[i], contextFont));
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            aTable2.addCell(cell);
        }
        // 
        String[] names = null;
        HostNodeDao dao = new HostNodeDao();
        HostNode node = (HostNode) dao.findByCondition("ip_address", ip).get(0);
        // Monitoriplist monitor = monitorManager.getByIpaddress(ip);
        if (node.getSysOid().startsWith("1.3.6.1.4.1.311")) {
            names = new String[] { "PhysicalMemory", "VirtualMemory" };
        } else {
            names = new String[] { "PhysicalMemory", "SwapMemory" };
        }
        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            aTable2.addCell("");
            cell = new Cell(new Phrase(names[i]));

            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            aTable2.addCell(cell);

            for (int j = 0; j < memoryItem.length; j++) {
                // 
                String value = "";
                cell = new Cell(new Phrase(value));

                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell);
            }
            String value = "";
            if (memMaxHash.get(name) != null) {
                value = (String) memMaxHash.get(name);
                Cell cell2 = new Cell(new Phrase(value));
                cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell2);
            } else {
                Cell cell3 = new Cell(new Phrase(value));
                cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell3);
            }
            String avgvalue = "";
            if (memAvgHash.get(name) != null) {
                avgvalue = (String) memAvgHash.get(name);
                Cell cell4 = new Cell(new Phrase(avgvalue));
                cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell4);
            } else {
                Cell cell5 = new Cell(new Phrase(avgvalue));
                cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable2.addCell(cell5);
            }

        } // end 
          // 
        Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "memory" + ".png");
        img.setAlignment(Image.MIDDLE);// 
        img2.scalePercent(75);
        document.add(aTable2);
        document.add(img2);
    }
    Table aTable3 = new Table(5);
    aTable3.setAutoFillEmptyCells(true);
    aTable3.setPadding(5);
    aTable3.setWidth(100);
    // float[] widthss1 = { 220f, 440f, 150f, 150f, 220f };
    // aTable3.setWidths(widthss1);
    // aTable3.setWidthPercentage(100);
    if (Disk != null && Disk.size() > 0) {
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable3.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        aTable3.addCell(cell);
        for (int i = 0; i < diskItemch.length; i++) {
            cell = new Cell(new Phrase(diskItemch[i], contextFont));
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            aTable3.addCell(cell);
        }
        // 

        for (int i = 0; i < Disk.size(); i++) {
            aTable3.addCell("");
            Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i)));
            String name = (String) diskhash.get("name");
            cell = new Cell(new Phrase(name));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            aTable3.addCell(cell);
            for (int j = 0; j < diskItem.length; j++) {
                String value = "";
                if (diskhash.get(diskItem[j]) != null) {
                    value = (String) diskhash.get(diskItem[j]);
                }
                cell = new Cell(new Phrase(value));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                aTable3.addCell(cell);
            }
        } // end 
          // 

        Image img3 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "disk" + ".png");
        img3.setAlignment(Image.MIDDLE);// 
        img3.scalePercent(78);
        document.add(aTable3);
        // document.add(new Paragraph("\n"));
        document.add(img3);

    }
    if (impReport.getChart() != null) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                    impReport.getChart().getWidth(), impReport.getChart().getHeight());
        } catch (IOException ioe) {
        }
        Image img3 = Image.getInstance(baos.toByteArray());
        img3.setAlignment(Image.MIDDLE);// 
        img3.scalePercent(76);
        document.add(new Paragraph("\n"));
        // document.add(aTable3);
        document.add(img3);
    }
    document.close();
}

From source file:com.jd.survey.web.pdf.StatisticsPdf.java

License:Open Source License

private void writeBooleanMatrixQuestionStatistics(Document document, Question question,
        List<QuestionStatistic> questionStatistics, String trueLabel, String falseLabel) throws Exception {

    NumberFormat percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);

    Table statsTable;/*from  w  w  w  .  j ava  2  s .  c o  m*/
    Cell cell;

    statsTable = new Table(question.getColumnLabels().size() + 1);
    statsTable.setWidth(94);
    statsTable.setBorder(0);
    statsTable.setOffset(5);
    statsTable.setPadding(2);
    statsTable.setDefaultCellBorder(0);

    //header
    cell = new Cell();
    cell.setBorder(Cell.BOTTOM);
    statsTable.addCell(cell);
    for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
        cell = new Cell(new Paragraph(columnLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.BOTTOM);
        statsTable.addCell(cell);
    }
    int rowIndex = 1;
    for (QuestionRowLabel rowLabel : question.getRowLabels()) {
        cell = new Cell(new Paragraph(rowLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.RIGHT);
        if ((rowIndex % 2) == 1) {
            cell.setBackgroundColor(new Color(244, 244, 244));
        }
        statsTable.addCell(cell);
        for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
            boolean found = false;
            cell = new Cell();
            if ((rowIndex % 2) == 1) {
                cell.setBackgroundColor(new Color(244, 244, 244));
            }
            for (QuestionStatistic questionStatistic : questionStatistics) {
                if (questionStatistic.getRowOrder().equals(rowLabel.getOrder())
                        && questionStatistic.getColumnOrder().equals(columnLabel.getOrder())
                        && questionStatistic.getEntry().equals("1")) {
                    cell.add(new Paragraph(
                            trueLabel + ": " + percentFormat.format(questionStatistic.getFrequency()),
                            normalFont));
                    found = true;
                    break;
                }
            }
            if (!found) {
                cell.add(new Paragraph(trueLabel + ": " + percentFormat.format(0), normalFont));
            }

            found = false;
            for (QuestionStatistic questionStatistic : questionStatistics) {
                if (questionStatistic.getRowOrder().equals(rowLabel.getOrder())
                        && questionStatistic.getColumnOrder().equals(columnLabel.getOrder())
                        && questionStatistic.getEntry().equals("0")) {
                    cell.add(new Paragraph(
                            falseLabel + ": " + percentFormat.format(questionStatistic.getFrequency()),
                            normalFont));
                    found = true;
                    break;
                }
            }
            if (!found) {
                cell.add(new Paragraph(falseLabel + ": " + percentFormat.format(0), normalFont));
            }

            statsTable.addCell(cell);
        }
        rowIndex++;
    }

    document.add(statsTable);

}

From source file:com.jd.survey.web.pdf.StatisticsPdf.java

License:Open Source License

private void writeNumericMatrixQuestionStatistics(Document document, Question question,
        List<QuestionStatistic> questionStatistics, String minimumLabel, String maximumLabel,
        String averageLabel, String standardDeviationLabel) throws Exception {

    NumberFormat percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);

    Table statsTable;/*w w w . j ava2s . c o m*/
    Cell cell;

    statsTable = new Table(question.getColumnLabels().size() + 1);
    statsTable.setWidth(94);
    statsTable.setBorder(0);
    statsTable.setOffset(5);
    statsTable.setPadding(2);
    statsTable.setDefaultCellBorder(0);

    //header
    cell = new Cell();
    cell.setBorder(Cell.BOTTOM);
    statsTable.addCell(cell);
    for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
        cell = new Cell(new Paragraph(columnLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.BOTTOM);
        statsTable.addCell(cell);
    }
    int rowIndex = 1;
    for (QuestionRowLabel rowLabel : question.getRowLabels()) {
        cell = new Cell(new Paragraph(rowLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.RIGHT);
        if ((rowIndex % 2) == 1) {
            cell.setBackgroundColor(new Color(244, 244, 244));
        }
        statsTable.addCell(cell);
        for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
            boolean found = false;
            cell = new Cell();
            if ((rowIndex % 2) == 1) {
                cell.setBackgroundColor(new Color(244, 244, 244));
            }
            for (QuestionStatistic questionStatistic : questionStatistics) {
                if (questionStatistic.getRowOrder().equals(rowLabel.getOrder())
                        && questionStatistic.getColumnOrder().equals(columnLabel.getOrder())) {
                    cell.add(new Paragraph(
                            minimumLabel + ": " + BigDecimalValidator.getInstance()
                                    .format(questionStatistic.getMin(), LocaleContextHolder.getLocale()),
                            normalFont));
                    cell.add(new Paragraph(
                            maximumLabel + ": " + BigDecimalValidator.getInstance()
                                    .format(questionStatistic.getMax(), LocaleContextHolder.getLocale()),
                            normalFont));
                    cell.add(new Paragraph(
                            averageLabel + ": " + BigDecimalValidator.getInstance()
                                    .format(questionStatistic.getAverage(), LocaleContextHolder.getLocale()),
                            normalFont));
                    cell.add(new Paragraph(standardDeviationLabel + ": "
                            + BigDecimalValidator.getInstance().format(
                                    questionStatistic.getSampleStandardDeviation(),
                                    LocaleContextHolder.getLocale()),
                            normalFont));

                    break;
                }
            }
            if (!found) {
            }

            statsTable.addCell(cell);
        }
        rowIndex++;
    }

    document.add(statsTable);

}

From source file:com.jd.survey.web.pdf.StatisticsPdf.java

License:Open Source License

private void writeCurrencyMatrixQuestionStatistics(Document document, Question question,
        List<QuestionStatistic> questionStatistics, String minimumLabel, String maximumLabel,
        String averageLabel, String standardDeviationLabel) throws Exception {

    NumberFormat percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);

    Table statsTable;//from w  w w  .  j av a  2s  . co  m
    Cell cell;

    statsTable = new Table(question.getColumnLabels().size() + 1);
    statsTable.setWidth(94);
    statsTable.setBorder(0);
    statsTable.setOffset(5);
    statsTable.setPadding(2);
    statsTable.setDefaultCellBorder(0);

    //header
    cell = new Cell();
    cell.setBorder(Cell.BOTTOM);
    statsTable.addCell(cell);
    for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
        cell = new Cell(new Paragraph(columnLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.BOTTOM);
        statsTable.addCell(cell);
    }
    int rowIndex = 1;
    for (QuestionRowLabel rowLabel : question.getRowLabels()) {
        cell = new Cell(new Paragraph(rowLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.RIGHT);
        if ((rowIndex % 2) == 1) {
            cell.setBackgroundColor(new Color(244, 244, 244));
        }
        statsTable.addCell(cell);
        for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
            boolean found = false;
            cell = new Cell();
            if ((rowIndex % 2) == 1) {
                cell.setBackgroundColor(new Color(244, 244, 244));
            }
            for (QuestionStatistic questionStatistic : questionStatistics) {
                if (questionStatistic.getRowOrder().equals(rowLabel.getOrder())
                        && questionStatistic.getColumnOrder().equals(columnLabel.getOrder())) {
                    cell.add(new Paragraph(
                            minimumLabel + ": " + CurrencyValidator.getInstance()
                                    .format(questionStatistic.getMin(), LocaleContextHolder.getLocale()),
                            normalFont));
                    cell.add(new Paragraph(
                            maximumLabel + ": " + CurrencyValidator.getInstance()
                                    .format(questionStatistic.getMax(), LocaleContextHolder.getLocale()),
                            normalFont));
                    cell.add(new Paragraph(
                            averageLabel + ": " + CurrencyValidator.getInstance()
                                    .format(questionStatistic.getAverage(), LocaleContextHolder.getLocale()),
                            normalFont));
                    cell.add(new Paragraph(standardDeviationLabel + ": "
                            + CurrencyValidator.getInstance().format(
                                    questionStatistic.getSampleStandardDeviation(),
                                    LocaleContextHolder.getLocale()),
                            normalFont));

                    break;
                }
            }
            if (!found) {
            }

            statsTable.addCell(cell);
        }
        rowIndex++;
    }

    document.add(statsTable);

}

From source file:com.jd.survey.web.pdf.StatisticsPdf.java

License:Open Source License

private void writeDateMatrixQuestionStatistics(Document document, Question question,
        List<QuestionStatistic> questionStatistics, String minimumLabel, String maximumLabel, String dateFormat)
        throws Exception {

    NumberFormat percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);

    Table statsTable;//from w  w  w  .jav a 2 s  .com
    Cell cell;

    statsTable = new Table(question.getColumnLabels().size() + 1);
    statsTable.setWidth(94);
    statsTable.setBorder(0);
    statsTable.setOffset(5);
    statsTable.setPadding(2);
    statsTable.setDefaultCellBorder(0);

    //header
    cell = new Cell();
    cell.setBorder(Cell.BOTTOM);
    statsTable.addCell(cell);
    for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
        cell = new Cell(new Paragraph(columnLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.BOTTOM);
        statsTable.addCell(cell);
    }
    int rowIndex = 1;
    for (QuestionRowLabel rowLabel : question.getRowLabels()) {
        cell = new Cell(new Paragraph(rowLabel.getLabel(), boldedFont));
        cell.setBorder(Cell.RIGHT);
        if ((rowIndex % 2) == 1) {
            cell.setBackgroundColor(new Color(244, 244, 244));
        }
        statsTable.addCell(cell);
        for (QuestionColumnLabel columnLabel : question.getColumnLabels()) {
            boolean found = false;
            cell = new Cell();
            if ((rowIndex % 2) == 1) {
                cell.setBackgroundColor(new Color(244, 244, 244));
            }
            for (QuestionStatistic questionStatistic : questionStatistics) {
                if (questionStatistic.getRowOrder().equals(rowLabel.getOrder())
                        && questionStatistic.getColumnOrder().equals(columnLabel.getOrder())) {
                    cell.add(new Paragraph(minimumLabel + ": "
                            + DateValidator.getInstance().format(questionStatistic.getMinDate(), dateFormat),
                            normalFont));
                    cell.add(new Paragraph(maximumLabel + ": "
                            + DateValidator.getInstance().format(questionStatistic.getMaxDate(), dateFormat),
                            normalFont));
                    break;
                }
            }
            if (!found) {
            }

            statsTable.addCell(cell);
        }
        rowIndex++;
    }

    document.add(statsTable);

}

From source file:com.sinkluge.reports.contracts.GenContractChecklist.java

public void create(Info in, Image toplogo) throws Exception {

    //adds the unchecked box
    Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg");
    Chunk ch2 = new Chunk(checkbox, -10, -10);
    Phrase checkboxPhrase = new Phrase();
    checkboxPhrase.add(ch2);/*from   w  w  w  .j  a v  a 2 s .  c  o  m*/
    int[] two = { 10, 90 };//sets the widths of the columns(2) with checkboxes

    //blank spacer for keeping tables apart
    Table spacer = new Table(1, 1);
    spacer.setBorderWidth(0);
    //spacer.setDefaultCellBorderWidth(0);
    spacer.setWidth(100);
    spacer.setPadding(0);
    spacer.setSpacing(0);
    Cell blank = new Cell();
    blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 1, Font.BOLD, new Color(255, 255, 255))));
    blank.setBorderWidth(0);
    blank.setLeading(0);
    spacer.addCell(blank);

    init();
    //document.setMargins(left, right, top, bottom);
    //add image
    Phrase p1 = new Phrase();
    int[] widths = { 60, 40 };
    Table table1 = new Table(2, 1);
    table1.setWidths(widths);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(2);
    table1.setSpacing(2);
    toplogo.scalePercent(20);
    //Chunk ch1=new Chunk(toplogo, -10, -80);
    Cell cell = new Cell(toplogo);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);
    //just added image

    //add title on right side
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\n" + title + " Checklist", new Font(Font.TIMES_ROMAN, 18, Font.BOLD)));
    cell.add(new Phrase("\n" + currentDate, new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);

    //add "To:" and "Re:"
    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    p1 = new Phrase("To:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD));
    cell.setVerticalAlignment("middle");
    cell.add(p1);
    cell.add(new Phrase("\t\t" + companyName, new Font(Font.TIMES_ROMAN, 14, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Re:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD)));
    cell.add(new Phrase("\t\t" + jobName, new Font(Font.TIMES_ROMAN, 14, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Enclosed:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD)));
    cell.add(new Phrase("\t\t" + title + " Agreement", new Font(Font.TIMES_ROMAN, 14, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(spacer);

    //add Instructions
    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "In order to finalize your agreement with " + shortName
                    + ", please complete all items as outlined below. "
                    + " It is essential to be finalized no later than ",
            new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.add(new Phrase(agreementDate + ".  ", new Font(Font.TIMES_ROMAN, 12, Font.BOLDITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    //p1 = new Phrase("Subcontractor Change Order Overview Report", new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "A subcontract is considered finalized and ready to activate when all of the attached items outlined below "
                    + "are completed, signed, and returned to " + shortName
                    + ". Do not make any changes directly to the contract documents."
                    + " Any alterations or amendments must be negotiated and mutually agreed upon in advance. If necessary, a new, "
                    + "updated contract will be sent. Contract negotiations are best in person and can be accomplished following the pre-"
                    + "construction conference.",
            new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(spacer);

    //add "Checklist:"
    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Checklist: ", new Font(Font.TIMES_ROMAN, 12, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //add "Business Information"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("top");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Business Information", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.add(new Phrase(" (* indicates required information)", new Font(Font.TIMES_ROMAN, 12, Font.ITALIC)));

    cell.add(new Phrase("\n     * Business Telephone Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Primary Contact Name", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Business Fax Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Mobile Telephone Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Email Address", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n     * Federal ID # or Social Security Number",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    if (insure) {
        cell.add(new Phrase("\n     * Contractor's License Number",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\n     * Attach copy of current contractor's license",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    }
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //add "Sign and Date the Agreement"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Sign and date the agreement", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    //add "initial all pages"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Initial front page where indicated", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    //add "provide signatures"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Provide appropriate signatures at Exhibit \"C\", Item #2",
            new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    //add "complete and sign exhibit d"
    if (insure) {
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setWidths(two);

        cell = new Cell(checkboxPhrase);
        cell.setBorderWidth(0);
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setVerticalAlignment("bottom");
        cell.add(new Phrase("Complete and sign Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        document.add(table1);

        //add "Forward"
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setWidths(two);

        cell = new Cell(checkboxPhrase);
        cell.setBorderWidth(0);
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setVerticalAlignment("bottom");
        cell.add(new Phrase(
                "Forward the required insurance certificates (per article 7 and Exhibit \"C\") to " + shortName,
                new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        document.add(table1);
    }

    //add "return all pages"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Return all pages of both completed copies of your " + title
            + " agreement.  Do not remove any pages.", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

}

From source file:com.sinkluge.reports.contracts.GenSubcontract.java

public void create(Info in, Image toplogo) throws Exception {

    //for the unchecked box
    Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg");
    Chunk ch2 = new Chunk(checkbox, -7, -7);
    Phrase checkboxPhrase = new Phrase();
    checkboxPhrase.add(ch2);//  w  ww .  j a va 2 s .  c o  m

    Font tnr8 = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL);

    Image iBox = Image.getInstance(in.path + "/WEB-INF/images/initialsBox.jpg");//(in.path + "/jsp/dev/images/epcologo3.jpg");
    Chunk ch3 = new Chunk(iBox, -3, -3);
    Phrase initialsBoxPhrase = new Phrase();
    initialsBoxPhrase.add(ch3);

    Phrase footerPhrase = new Phrase(
            attr.get("full_name") + ", " + attr.get("address") + ", " + attr.get("city") + ", "
                    + attr.get("state") + " " + attr.get("zip") + "\nPhone: " + attr.get("phone") + "   Fax: "
                    + attr.get("fax") + "   " + attr.get("url") + "   Page: ",
            new Font(Font.TIMES_ROMAN, 7, Font.BOLD | Font.ITALIC));

    HeaderFooter footer = new HeaderFooter(footerPhrase, true);
    footer.setBorder(0);
    footer.setAlignment(Element.ALIGN_CENTER);
    init(40, 40, 40, 40, footer);

    Phrase underLinePhrase = new Phrase(
            "  ___________________________________________________________________________________________  ",
            new Font(Font.TIMES_ROMAN, 10, Font.BOLD));
    int[] twoC = { 30, 70 };
    int[] twoD = { 5, 95 };
    int[] twoF = { 10, 90 };
    int[] twoE = { 25, 75 };
    int[] twoG = { 40, 60 };
    int[] threeD = { 4, 11, 85 };
    int[] threeB = { 70, 15, 15 };
    //int[] threeC = { 47, 5, 48 };
    int[] five = { 18, 25, 14, 18, 25 };

    //blank spacer for keeping tables apart
    Table spacer = new Table(1, 1);
    spacer.setBorderWidth(0);
    //spacer.setDefaultCellBorderWidth(0);
    spacer.setWidth(100);
    spacer.setPadding(0);
    spacer.setSpacing(0);
    Cell blank = new Cell();
    blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD, new Color(255, 255, 255))));
    blank.setBorderWidth(0);
    //blank.setLeading(0);
    spacer.addCell(blank);

    //start of document
    //document.setFooter(footer);

    //document.setFooter(footer);

    //add image
    Phrase p1 = new Phrase();
    Table table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(2);
    table1.setSpacing(2);
    toplogo.scalePercent(20);
    //Chunk ch1=new Chunk(toplogo, -36, -55);
    //p1.add(ch1);
    Cell cell = new Cell(toplogo);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(cell);

    document.add(table1);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setLeading(19);
    cell.add(
            new Phrase(title.toUpperCase() + " AGREEMENT BETWEEN CONTRACTOR AND " + cTitle.toUpperCase() + "\n",
                    new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setUseDescender(true);
    cell.setBackgroundColor(Color.lightGray);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setSpacing(0);
    cell = new Cell();
    cell.add(underLinePhrase);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\nDOCUMENTS CONTAINED HEREIN:\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(3, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setWidths(threeD);
    table1.setPadding(0);
    table1.setSpacing(0);
    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Page 1", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Agreement Declaration", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.add(new Phrase("    Initial boxes below to indicate complete review of this agreement.",
            new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Page 2", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Articles of " + title + " Agreement and Standard Provisions", tnr8));
    cell.add(new Phrase("    Sign the concluding page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Exhibit \"A\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("List of Contract Documents, Plans, Specifications, Etc.", tnr8));
    cell.setBorder(0);
    //cell.add(new Phrase("    Read and initial each page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Exhibit \"B\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle + "'s Scope of Work", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Exhibit \"C\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase(cTitle + "'s Special Provisions and Procedure Requirements", tnr8));
    cell.add(new Phrase("    Read and complete \"Release Authorization\" information.",
            new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    table1.addCell(blank);
    if (insure) {
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(cTitle + " Cost Breakdown", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.add(new Phrase("    Complete and return with signed contract",
                new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);

        table1.addCell(blank);
    }
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.setColspan(2);
    cell.add(new Phrase("NOTE OTHERS HERE:", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    table1 = new Table(3);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(threeB);
    table1.addCell(blank);
    cell = new Cell();
    cell.setColspan(2);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("(Initial) Entire agreement thoroughly reviewed:\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();

    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Contractor: ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle + ": ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setColspan(3);
    cell.add(underLinePhrase);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("AGREEMENT", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" made as of " + agreementDate, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("BETWEEN", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Contractor: \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("full_name") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("address") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("city") + ", " + attr.get("state") + " " + attr.get("zip"),
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Contractor\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("AND", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the " + cTitle + ": \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"" + cTitle + "\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the the fixed sum of  " + DocHelper.numberAndText(amount) + " \n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    //cell.add(new Phrase("     " + amountString + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Project known as:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Project\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("BY", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Architect:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Architect\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Project owner:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Owner\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("WHEREFORE", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Contractor and " + cTitle + " agree as follows:\n\n\n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);
    /*
          table1 = new Table(1);
          table1.setBorderWidth(0); table1.setWidth(100);
          //table1.setDefaultCellBorder(0);
          table1.setPadding(0);
               
          cell = new Cell();
          cell.setHorizontalAlignment("center");
          cell.setVerticalAlignment("middle");
          //cell.add(new Phrase("\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
          cell.setBorder(Rectangle.BOTTOM | Rectangle.TOP);
          cell.setBorderWidth(1.1f);
          cell.add(footerPhrase);
          cell.add(new Phrase(" 1\n ",
    new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
          //cell.add(footerPhrase2);
                  
          cell.setBorder(0); table1.addCell(cell);
            
          document.add(table1);
    */
    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " AGREEMENT\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setLeading(19);
    cell.setUseDescender(true);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    Paragraph para = new Paragraph(8, "\n\n" + text.toString(), tnr8);

    document.add(para);

    Phrase p;

    document.add(spacer);
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setWidths(twoC);
    table1.setPadding(0);
    p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("_________________________________________________________________",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("            General Contractor                                               Title\n",
            tnr8));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setColspan(2);
    cell.add(new Phrase("\nThis " + title
            + " Agreement supercedes all other proposals, documents, and negotiations whether written or verbal\n\n",
            new Font(Font.TIMES_ROMAN, 8, Font.BOLDITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("_________________________________________________________________",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "            " + cTitle + "                                                       Title\n", tnr8));
    cell.setBorder(0);
    table1.addCell(cell);
    table1.setCellsFitPage(true);
    table1.setTableFitsPage(true);
    document.add(table1);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle.toUpperCase() + " INFORMATION\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setLeading(19);
    cell.setUseDescender(true);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(new Phrase("\n"));

    table1 = new Table(5, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(1);
    table1.setWidths(five);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Federal I.D. : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(federal_id, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("(Both Required)", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));

    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("License Number : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(license_number, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Contact : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.setUseDescender(true);
    cell.add(new Phrase(contactName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Company : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Telephone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.setUseDescender(true);
    cell.add(new Phrase(telephone, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Fax : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(fax, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Mobile phone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(mobile, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("E-mail : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(email, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    document.add(table1);

    //document.add(spacer);

    table1 = new Table(1, 1);
    //table1.setBorderWidth(4);
    //table1.setBorderColor(Color.lightGray);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setBorder(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    if (insure)
        cell.add(new Phrase("Please attach a COPY of your current state license to this page:",
                new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    else
        cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    if (insure)
        cell.add(new Phrase("\n\nAttach\nCopy of\nContractor's\nLicense\nHere\n(If Applicable)",
                new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray)));
    else
        cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //document.setMargins(72, 72, 36, 36);
    document.newPage();

    table1 = new Table(1, 1);
    table1.setOffset(0);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidth(100);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"A\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("CONTRACT DOCUMENTS, PLANS,\nSPECIFICATIONS, ADDENDUMS, ETC.\n",
            new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBackgroundColor(Color.lightGray);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\n" + subName
            + " is responsible to verify versions, dates, and completeness of documents that were used in the preparation of the "
            + cTitle + "'s bid proposal before signing this " + title + " Agreement\n", tnr8));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("This " + title + " Agreement includes, but is not limited to the following items:",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    cell.setBorder(Rectangle.BOTTOM);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);
    document.add(table1);

    Paragraph prgh = new Paragraph("\n" + bidDocuments + "\n", tnr8);
    prgh.setLeading(10);
    document.add(prgh);

    document.add(spacer);
    /*
     p = new Phrase("\n"+bidDocuments, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
     p.setLeading(10);
     cell= new Cell(p);
     cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
     cell.setBorderWidth(0.5f);
     //cell.setBorderColor(Color.lightGray);
     cell.setHorizontalAlignment("left");
     cell.setVerticalAlignment("middle");
     //cell.setLeading(10);
     cell.setUseDescender(true);
     table1.addCell(cell);
     */

    table1 = new Table(1, 1);
    table1.setOffset(0);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidth(100);
    table1.setTableFitsPage(true);
    p = new Phrase("\nPlease note below all verbal conditions or instructions, if any, that the " + cTitle
            + " has received during the bid process which might affect the scope of work as required by the contract documents",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    p.setLeading(10);
    cell = new Cell(p);
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(0.5f);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(cell);

    document.add(table1);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    table1.setWidth(100);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"B\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("SCOPE OF WORK\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "\nThis " + title + " Agreement includes, but is not limited to the following items:\n\n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(Rectangle.BOTTOM);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);

    document.add(table1);

    prgh = new Paragraph("\n" + contractDescription + "\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
    prgh.setLeading(10);
    document.add(prgh);
    //cell= new Cell(prgh);
    //cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    //cell.setBorderWidth(0.5f);
    //cell.setBorderColor(Color.lightGray);
    //cell.setHorizontalAlignment("left");
    //cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    //cell.setUseDescender(true);
    //table1.addCell(cell);

    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    table1.setWidth(100);
    table1.setTableFitsPage(true);

    p = new Phrase("\nAll " + cTitle
            + " bid proposal conditions that are outside of, in addition to or are limiting of conditions contained in the Contract Documents are of no effect and are invalid to the "
            + title + " Agreement unless expressly included in the description above.", tnr8);
    p.setLeading(10);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);

    document.add(table1);

    //document.setMargins(10, 10, 30, 30);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"C\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle.toUpperCase() + " SPECIAL PROVISIONS AND REQUIREMENTS\n",
            new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    int count = 1;

    if (insure) {

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(4);
        cell = new Cell();
        cell.add(new Phrase("1.     Insurance Provisions (If Applicable)",
                new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
        //cell.setLeading(6);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        count++;
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoD);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(6);
        cell.add(new Phrase(
                "a.  The " + cTitle + " is required to name the following as additional Primary-Insured:",
                tnr8));
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoE);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Contractor:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(attr.get("full_name"), new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Owner:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(ownerName, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Other:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("_______________________________________", tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoD);
        table1.setOffset(4);
        p = new Phrase("b.  The " + cTitle
                + " must provide verification of current Worker's Compensation coverage with reference to "
                + jobName + " on the policy.", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
        p.setLeading(8);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(8);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
    }

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(4);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Release Authorizations", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    count++;
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    table1 = new Table(2, 1);
    table1.setOffset(4);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoD);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    p = new Phrase(
            "List any Owners, Partners, and/or Corporate Officers who are legally authorized to sign for "
                    + subName
                    + " and who will be signing the MONTHLY REQUEST FOR PAYMENT, FINAL REQUEST FOR PAYMENT, and LIEN WAIVER documents:\n\n",
            tnr8);
    p.setLeading(8);
    p1 = new Phrase(
            "       ______________________________________________________________________          ______________________________________________________________________\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    //p1.setLeading(0);
    Phrase p2 = new Phrase(
            "       Printed name and title                                                                                                                   Signature\n\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    //cell.setLeading(8);
    cell.add(p);
    cell.add(p1);
    cell.add(p2);
    cell.add(p1);
    cell.add(p2);
    cell.add(p1);
    cell.add(p2);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Shop Drawings - Samples - Submittals",
            new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    count++;

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoD);
    table1.setOffset(2);
    p = new Phrase(
            "All shop drawings, materials samples, and submittals shall be submitted to the Contractor within 30 days of the issuance of this "
                    + title
                    + " Agreement unless specifically noted below.  All submitted items shall be in number and type as per the contract documents including, but not limited to, the following:",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoF);
    table1.setOffset(4);

    p = new Phrase("--The number of copies of each submittal for " + jobName + " is " + submittal_copies
            + ".\n--All submittals, of any type, are due on or before " + dueDate
            + " unless specifically noted otherwise.\n", tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    String submittals = "";
    if (!submittalVector.isEmpty()) {
        p = new Phrase("            Due Date:\n", new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
        p.setLeading(8);
        cell = new Cell(p);
        cell.setColspan(2);
        cell.setBorder(0);
        table1.addCell(cell);
        for (int i = 0; i < submittalVector.size(); i++) {
            submittals += (String) submittalVector.elementAt(i) + "\n";
        }
        p = new Phrase(submittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
        p.setLeading(8);
        cell = new Cell(p);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
    } else {
        p = new Phrase("\nSubmittals required per contract documents and specifications.\n",
                new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
        p.setLeading(8);
        cell = new Cell(p);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
    }
    p = new Phrase("\n(" + subName
            + " is responsible for all submittals required in the Contract Documents as pertaining to labor and materials included in the scope of this "
            + title + " Agreement regardless of items listed, not listed, or incorrectly listed above.)",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    p.setLeading(8);
    cell = new Cell(p);

    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(1);
    table1.setWidths(twoD);
    table1.setOffset(2);
    p = new Phrase(cTitle.toUpperCase()
            + " acknowledges that review and approval of any type of submittal which deviates from the Project Plans and Specifications does NOT relieve the "
            + cTitle
            + " from costs, penalties and all other remedies required to meet the published specifications where the "
            + cTitle
            + " failed to notify the Owner/Architect/Contractor in writing of the variations from the specifications and failed to obtain written approval for EACH variation from the published specifications.",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(8);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(2);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Project Close-out", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    count++;
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(4);
    table1.setWidths(twoD);
    p = new Phrase(
            "All project close-out documents, materials, and Owner-training required by the Contract Documents shall be submitted to the Contractor PRIOR to payment of the "
                    + cTitle
                    + "'s 90% completion payment request.  The requirements shall include, but not be limited to, the following:",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(8);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(0);
    table1.setWidths(twoG);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("\"O & M\" Submittals: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(omSubmittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Full Warranty: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(fullWarranty, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Up-to-date Lien Release(s): ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(lienReleases, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Signed Training Form: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(signedTraining, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Materials-Equip-Specialty Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(specialtyItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Other Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(otherItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    if (insure) {
        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setOffset(2);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(count + ".     " + cTitle + " Safety Program (If Applicable)",
                new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(2);
        table1.setWidths(twoD);
        p = new Phrase(
                cTitle + " will submit one copy of the " + cTitle + "'s job-specific safety program to "
                        + attr.get("full_name")
                        + " before any equipment, manpower, or materials are brought onto the Project site.  ",
                tnr8);
        p.setLeading(8);
        cell = new Cell(p);
        p = new Phrase(cTitle + " will require it's " + cTitle.toLowerCase()
                + "s to have in place a job-specific safety program before they enter the Project site.", tnr8);
        p.setLeading(8);
        cell.add(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(8);

        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
    }

    if (insure) {
        document.newPage();

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"D\"", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
        cell.setLeading(6);
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(cTitle.toUpperCase() + "'S COST BREAKDOWN\n",
                new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
        cell.setBackgroundColor(Color.lightGray);
        cell.setUseDescender(true);
        cell.setLeading(17);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(2);
        p = new Phrase("The following information is to be supplied by " + subName + " for " + jobName
                + ". List all SUPPLIERS and SUBCONTRACTORS for approval and payment confirmation (attach additional pages if needed):",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        p.setLeading(12);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(
                "     Name                                        City                                  Phone                                                                            Estimated Dollar Amount",
                tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        p = new Phrase(
                "________________________________________________________________________  $___________________\n",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        for (int i = 0; i < 10; i++) {
            cell.add(p);
        }
        cell.setBorder(0);
        table1.addCell(cell);

        p = new Phrase(
                "Supplier accepts full responsibility for acts and omissions of his subcontractors and suppliers.  No suppliers or subcontractors are to be added or deleted without prior notification to "
                        + attr.get("full_name") + ".",
                new Font(Font.TIMES_ROMAN, 8, Font.ITALIC));
        p.setLeading(10);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(15);
        cell.setBorder(0);
        table1.addCell(cell);
        p = new Phrase(
                "List the primary phases of your contracted scope of work and the associated costs.  This information may be released to the Owner if disputes arise over future billings and progress payments.",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        p.setLeading(12);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(15);
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(
                "Description/Phase of Work                     Labor                      Material                    Equipment/Tools       Sub-subcontractor     Total",
                tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        p = new Phrase(
                "________________________  $____________ $____________ $____________ $____________ $____________ \n",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        for (int i = 0; i < 13; i++) {
            cell.add(p);
        }
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        document.add(spacer);

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setOffset(2);
        table1.setPadding(1);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.UNDERLINE)));
        cell.add(new Phrase("\n" + cTitle, new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        document.add(spacer);
        document.add(spacer);

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\nPrint Name of Authorized Company Officer",
                new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        document.add(spacer);
        document.add(spacer);
        table1 = new Table(1, 1);
        table1.setOffset(0);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\nAuthorized Signature", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

    }

}