Example usage for com.lowagie.text Font TIMES_ROMAN

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

Introduction

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

Prototype

int TIMES_ROMAN

To view the source code for com.lowagie.text Font TIMES_ROMAN.

Click Source Link

Document

a possible value of a font family.

Usage

From source file:ambit2.db.reporters.PDFReporter.java

public void header(Document output, Q query) {

    output.addCreationDate();/*ww w. j  a v a2 s .co  m*/
    output.addCreator(getClass().getName());
    output.addSubject("");
    output.addAuthor("http://ambit.sourceforge.net");
    output.addHeader("License", getLicenseURI());
    output.addTitle(query.toString());
    output.addKeywords(query.toString());

    if (getLicenseURI() != null) {
        HeaderFooter footer = new HeaderFooter(new Phrase(String.format("License %s", getLicenseURI())), false);
        footer.setAlignment(Element.ALIGN_CENTER);
        output.setFooter(footer);
    }

    output.open();

    font = new Font(Font.TIMES_ROMAN, 10, Font.NORMAL);

    table = new PdfPTable(new float[] { 3f, 5f });
    table.setWidthPercentage(100);

    try {
        writeHeader(output);
    } catch (Exception x) {

    }

}

From source file:br.com.nfsconsultoria.azcontrole.bean.VendaBean.java

public void preProcessPDF(Object document) throws IOException, BadElementException, DocumentException {
    Document pdf = (Document) document;
    pdf.setPageSize(PageSize.A4);//from  www  .j av a  2  s.  c o  m
    pdf.addAuthor("Luis Carlos Santos");
    pdf.addTitle("Acordo Cadastrados");
    pdf.addCreator("NFS Consultoria");
    pdf.addSubject("Acordo Cadastrados");
    pdf.open();

    Font catFont = new Font(Font.TIMES_ROMAN, 18, Font.BOLD);

    Paragraph p = new Paragraph("Relatrio de Acordos", catFont);
    p.setAlignment(Element.ALIGN_CENTER);
    p.setSpacingAfter(20);

    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    String logo = externalContext.getRealPath("") + File.separator + "resources" + File.separator + "images"
            + File.separator + "banner.png";

    pdf.add(Image.getInstance(logo));
    pdf.add(p);
}

From source file:bucks.AuditSheet.java

License:Open Source License

void generateSheet(HttpServletResponse res, List<Batch> batches) {

    ///*from  w  w  w.  ja v a  2  s .  c o  m*/
    // paper size legal (A4) 8.5 x 11
    // page 1-inch = 72 points
    //
    String spacer = "   \n";
    ServletOutputStream out = null;
    String filename = "marketbucks_audit_sheet.pdf";
    try {
        // space
        //         
        Rectangle pageSize = new Rectangle(612, 792); // 8.5" X 11"
        Document document = new Document(pageSize, 36, 36, 18, 18);// 18,18,54,35         
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        document.open();
        URL imgUrl = new URL(imageUrl);
        Image image = Image.getInstance(imgUrl);
        image.scalePercent(20f);
        // image.scaleAbsolute(100f, 100f);// width, height
        // image.setRotation(3.1f); // in radians
        // image.setRotationDegrees(90f); // degrees
        // image.setSpacingBefore(10f);
        // image.setSpacingAfter(10f);
        // image.setWidthPercentage(25.0f);
        Font fnt = new Font(Font.TIMES_ROMAN, 12, Font.NORMAL);
        Font fntb = new Font(Font.TIMES_ROMAN, 12, Font.BOLD);
        Font fntb2 = new Font(Font.TIMES_ROMAN, 14, Font.BOLD);
        Phrase spacePhrase = new Phrase();
        Chunk ch = new Chunk(spacer, fnt);
        spacePhrase.add(ch);

        float[] widths = { 25f, 75f }; // percentages
        PdfPTable headTable = new PdfPTable(widths);
        headTable.setWidthPercentage(100);
        headTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        headTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

        PdfPCell cell = new PdfPCell(image);
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        headTable.addCell(cell);

        Phrase phrase = new Phrase();
        ch = new Chunk("Printed Market Bucks Audit Sheet\n ", fntb2);
        phrase.add(ch);
        Paragraph pp = new Paragraph();
        pp.setIndentationLeft(20);
        pp.setAlignment(Element.ALIGN_LEFT);
        pp.add(phrase);
        cell = new PdfPCell(pp);
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        headTable.addCell(cell);
        document.add(headTable);
        //
        document.add(spacePhrase);
        document.add(spacePhrase);
        //
        float[] widths3 = { 50f, 50f }; // percentages
        PdfPTable table = new PdfPTable(widths3);
        table.setWidthPercentage(100);
        table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        phrase = new Phrase();
        ch = new Chunk(" Date: ", fntb);
        phrase.add(ch);
        ch = new Chunk(Helper.getToday() + "\n\n\n", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
        // 
        phrase = new Phrase();
        ch = new Chunk(" ", fntb); // empty cell
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
        //         
        document.add(table);
        //
        phrase = new Phrase(new Chunk("\n", fnt));
        document.add(phrase);
        //
        float[] widths2 = { 15f, 10f, 15f, 15f, 15f, 15f, 15f }; // percentages
        table = new PdfPTable(widths2);
        table.setWidthPercentage(90);
        // table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        // table.getDefaultCell().setPadding(5);
        phrase = new Phrase();
        ch = new Chunk("Count of MB/GC", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("Value", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("Total Dollars", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("Printed By", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("Start Number", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("End Number", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("Printed Date", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        // next rows
        //
        for (Batch one : batches) {
            phrase = new Phrase();
            ch = new Chunk(one.getBatch_size(), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);

            phrase = new Phrase();
            ch = new Chunk("$" + one.getValue() + ".00", fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);
            //
            phrase = new Phrase();
            ch = new Chunk(moneyFormat.format(one.getTotal()), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);
            //
            phrase = new Phrase();
            ch = new Chunk(one.getUser().toString(), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);

            phrase = new Phrase();
            ch = new Chunk(one.getStart_seq(), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);

            phrase = new Phrase();
            ch = new Chunk(one.getEnd_seq(), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);

            phrase = new Phrase();
            ch = new Chunk(one.getDate(), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setBorderWidth(1f);
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setPadding(4);
            cell.setLeading(2f, 1.2f);
            table.addCell(cell);
        }
        document.add(table);
        //
        document.add(spacePhrase);
        document.add(spacePhrase);
        //
        ch = new Chunk("Audit By:____________________________________________________________________\n\n",
                fnt);
        phrase = new Phrase();
        phrase.add(ch);
        document.add(phrase);
        ch = new Chunk("           :_______________________________________)_____________________________\n\n",
                fnt);
        phrase = new Phrase();
        phrase.add(ch);
        document.add(phrase);
        ch = new Chunk("           :_____________________________________________________________________\n\n",
                fnt);
        phrase = new Phrase();
        phrase.add(ch);
        document.add(phrase);
        //
        document.add(spacePhrase);
        document.add(spacePhrase);
        //
        document.close();
        writer.close();
        res.setHeader("Expires", "0");
        res.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
        res.setHeader("Pragma", "public");
        //
        // setting the content type
        res.setHeader("Content-Disposition", " attachment; filename=" + filename);
        res.setContentType("application/pdf");
        //
        // the contentlength is needed for MSIE!!!
        res.setContentLength(baos.size());
        //
        out = res.getOutputStream();
        if (out != null) {
            baos.writeTo(out);
        }
    } catch (Exception ex) {
        System.err.println(ex);
    }
}

From source file:bucks.RedeemInvoice.java

License:Open Source License

void generateInvoice(HttpServletResponse res, Redeem redeem) {

    ///*from   w w  w . j  a va 2 s .  c  o  m*/
    // paper size legal (A4) 8.5 x 11
    // page 1-inch = 72 points
    //
    String spacer = "   \n";
    User user = redeem.getUser();
    Vendor vendor = redeem.getVendor();
    List<Buck> bk_bucks = redeem.getBk_bucks();
    List<Buck> gc5_bucks = redeem.getGc5_bucks();
    List<Buck> gc20_bucks = redeem.getGc20_bucks();
    List<Buck> gc_bucks = redeem.getGc_bucks();
    List<Dispute> disputes = redeem.getDisputes();
    int bk_total = 0, gc5_total = 0, gc20_total = 0, total = 0;
    if (bk_bucks.size() > 0) {
        bk_total = bk_bucks.size() * 3;
    }
    if (gc5_bucks.size() > 0) {
        gc5_total = gc5_bucks.size() * 5;
    }
    if (gc20_bucks.size() > 0) {
        gc20_total = gc20_bucks.size() * 20;
    }
    total = bk_total + gc5_total + gc20_total;
    String vendor_name = "";
    if (vendor != null) {
        vendor_name = vendor.getCleanName();
    }
    ServletOutputStream out = null;
    String filename = "invoice_" + vendor_name + "_" + redeem.getId() + ".pdf";
    try {
        // space
        //         
        Rectangle pageSize = new Rectangle(612, 792); // 8.5" X 11"
        Document document = new Document(pageSize, 36, 36, 18, 18);// 18,18,54,35         
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        document.open();
        Image image = Image.getInstance(imageUrl);
        // image = Image.getInstance(byte bytes[]);// generated image
        image.scalePercent(20f);
        Font fnt = new Font(Font.TIMES_ROMAN, 12, Font.NORMAL);
        Font fntb = new Font(Font.TIMES_ROMAN, 12, Font.BOLD);
        Font fntb2 = new Font(Font.TIMES_ROMAN, 14, Font.BOLD);

        //
        Phrase spacePhrase = new Phrase();
        Chunk ch = new Chunk(spacer, fnt);
        spacePhrase.add(ch);

        float[] widths = { 15f, 85f }; // percentages
        PdfPTable headTable = new PdfPTable(widths);
        headTable.setWidthPercentage(100);
        headTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        headTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        // image.setWidthPercentage(15.0f);
        PdfPCell cell = new PdfPCell(image);
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        // cell.setFixedHeight(46f);
        headTable.addCell(cell);

        Phrase phrase = new Phrase();
        ch = new Chunk(
                "City of Bloomington Community Farmers Market\n Gift Certificates/Market Bucks Invoice\n ",
                fntb2);
        phrase.add(ch);
        Paragraph pp = new Paragraph();
        pp.setIndentationLeft(20);
        pp.setAlignment(Element.ALIGN_LEFT);
        pp.add(phrase);
        cell = new PdfPCell(pp);
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        headTable.addCell(cell);
        document.add(headTable);
        //
        float[] widths3 = { 50f, 50f }; // percentages
        PdfPTable table = new PdfPTable(widths3);
        table.setWidthPercentage(100);
        table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        phrase = new Phrase();
        ch = new Chunk(" Vendor Name: ", fntb);
        phrase.add(ch);
        ch = new Chunk(vendor.getFullName(), fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
        //         
        phrase = new Phrase();
        ch = new Chunk("Date: ", fntb);
        phrase.add(ch);
        ch = new Chunk(redeem.getDate(), fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
        phrase = new Phrase();
        ch = new Chunk(" Vendor Number: ", fntb);
        phrase.add(ch);
        ch = new Chunk(vendor.getId(), fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
        phrase = new Phrase(); // empty cell
        ch = new Chunk(" ", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
        table.addCell(cell); // extra space
        table.addCell(cell);
        document.add(table);
        //
        phrase = new Phrase(new Chunk("\n", fnt));
        document.add(phrase);
        //
        float[] widths2 = { 30f, 25f, 15f, 15f, 15f }; // percentages
        table = new PdfPTable(widths2);
        table.setWidthPercentage(90);
        // table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        // table.getDefaultCell().setPadding(5);
        phrase = new Phrase();
        ch = new Chunk("Type of Voucher", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("City Account Number", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("Quantity", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("Multiply", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("Value", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setBorderWidth(2f);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        // second row
        phrase = new Phrase();
        ch = new Chunk("Market Bucks", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("201-18-1865003-47240", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        //
        phrase = new Phrase();
        String str = " ";
        if (bk_bucks.size() > 0) {
            str = "" + bk_bucks.size();
        }
        ch = new Chunk(str, fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("x $3.00 = ", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);

        phrase = new Phrase();
        str = " ";
        if (bk_total > 0) {
            str = "$" + bk_total + ".00";
        }
        ch = new Chunk(str, fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        table.addCell(cell);
        //
        // 3rd row
        phrase = new Phrase();
        ch = new Chunk("$5 Gift Cerificates", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("201-18-1865003-47230", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        //
        phrase = new Phrase();
        str = " ";
        if (gc5_bucks.size() > 0) {
            str = "" + gc5_bucks.size();
        }
        ch = new Chunk(str, fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("x $5.00 = ", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);

        phrase = new Phrase();
        str = " ";
        if (gc5_total > 0) {
            str = "$" + gc5_total + ".00";
        }
        ch = new Chunk(str, fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        table.addCell(cell);
        //
        // 4th row
        phrase = new Phrase();
        ch = new Chunk("$20 Gift Certificates", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("201-18-1865003-47230", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        //
        phrase = new Phrase();
        str = " ";
        if (gc20_bucks.size() > 0) {
            str = "" + gc20_bucks.size();
        }
        ch = new Chunk(str, fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        table.addCell(cell);

        phrase = new Phrase();
        ch = new Chunk("x $20.00 = ", fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        table.addCell(cell);
        str = " ";
        if (gc20_total > 0) {
            str = "$" + gc20_total + ".00";
        }
        phrase = new Phrase();
        ch = new Chunk(str, fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(4);
        table.addCell(cell);
        //
        // 5th row total
        phrase = new Phrase();
        ch = new Chunk(" Total Value: ", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setColspan(4);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setBorderWidth(2f);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk("$" + total + ".00", fntb);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setBorderWidth(2f);
        cell.setPadding(4);
        cell.setLeading(2f, 1.2f);
        table.addCell(cell);
        document.add(table);
        //
        //
        float[] withs5 = { 100f };
        table = new PdfPTable(withs5);
        table.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase(" "));
        cell.setBorder(Rectangle.BOTTOM);
        // cell.setBorderColorBottom(Color.BLACK);
        cell.setBorderWidthBottom(2f);
        table.addCell(cell);
        document.add(table);
        //
        ch = new Chunk("\n", fnt);
        phrase = new Phrase();
        phrase.add(ch);
        document.add(phrase);
        //
        // float[] widths3 = {50f, 50f}; // percentages
        table = new PdfPTable(widths3);
        table.setWidthPercentage(100);
        // table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        phrase = new Phrase();
        ch = new Chunk(" Data Entry Completed by: ", fntb);
        phrase.add(ch);
        ch = new Chunk(user.getFullName(), fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(cell);
        //
        phrase = new Phrase();
        ch = new Chunk(" Invoice Number: ", fntb);
        phrase.add(ch);
        ch = new Chunk(redeem.getId(), fnt);
        phrase.add(ch);
        cell = new PdfPCell(phrase);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(cell);
        document.add(table);
        document.add(spacePhrase);
        document.add(spacePhrase);
        //
        // adding bucks and GC
        //
        float[] widths4 = { 100f }; // percentages
        table = new PdfPTable(widths4);
        table.setWidthPercentage(100);
        // table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        int row = 1, col = 1;
        if (bk_bucks.size() > 0) {
            phrase = new Phrase();
            ch = new Chunk(" Market Bucks ", fntb);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorderWidth(2f);
            table.addCell(cell);
            phrase = new Phrase();
            for (Buck one : bk_bucks) {
                ch = new Chunk("" + one.getId() + " ", fntb);
                phrase.add(ch);
                col++;
                if (col > 15) {
                    row++;
                    col = 1;
                    cell = new PdfPCell(phrase);
                    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    table.addCell(cell);
                    phrase = new Phrase();
                }
            }
            if (col > 1) {
                cell = new PdfPCell(phrase);
                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                table.addCell(cell);
            }
            if (row < 10) {
                for (int j = 0; j < 2; j++) {
                    phrase = new Phrase();
                    ch = new Chunk(" ", fntb);
                    phrase.add(ch);
                    cell = new PdfPCell(phrase);
                    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    table.addCell(cell);
                    row++;
                }
            }
        }
        col = 1;
        if (gc_bucks.size() > 0) {
            phrase = new Phrase();
            ch = new Chunk(" Gift Certificates ", fntb);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorderWidth(2f);
            table.addCell(cell);
            phrase = new Phrase();
            for (Buck one : gc_bucks) {
                ch = new Chunk("" + one.getId() + " ", fntb);
                phrase.add(ch);
                col++;
                if (col > 15) {
                    row++;
                    col = 1;
                    cell = new PdfPCell(phrase);
                    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    table.addCell(cell);
                    phrase = new Phrase();
                }
            }
            if (col > 1) {
                cell = new PdfPCell(phrase);
                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                table.addCell(cell);
            }
            if (row < 15) {
                for (int j = 0; j < 2; j++) {
                    phrase = new Phrase();
                    ch = new Chunk(" ", fntb);
                    phrase.add(ch);
                    cell = new PdfPCell(phrase);
                    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    table.addCell(cell);
                    row++;
                }
            }
        }
        if (disputes != null && disputes.size() > 0) {
            phrase = new Phrase();
            ch = new Chunk(" Disputed Market Bucks and/or Gift Certificates (number: reason)", fntb);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorderWidth(2f);
            table.addCell(cell);
            row++;
            for (Dispute one : disputes) {
                phrase = new Phrase();
                ch = new Chunk(one.getBuck_id() + ": " + one.getReason(), fnt);
                phrase.add(ch);
                if (one.hasNotes()) {
                    ch = new Chunk("\nNotice: " + one.getNotes(), fnt);
                    phrase.add(ch);
                    row++;
                }
                cell = new PdfPCell(phrase);
                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                table.addCell(cell);
                row++;
            }
        }
        if (redeem.hasNotes()) {
            phrase = new Phrase();
            ch = new Chunk("\nNotice: " + redeem.getNotes(), fnt);
            phrase.add(ch);
            cell = new PdfPCell(phrase);
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            table.addCell(cell);
            row++;
        }
        if (row < 18) {
            for (int j = row; j < 18; j++) {
                phrase = new Phrase();
                ch = new Chunk(" ", fntb);
                phrase.add(ch);
                cell = new PdfPCell(phrase);
                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                table.addCell(cell);
            }
        }

        document.add(table);
        document.close();
        writer.close();
        res.setHeader("Expires", "0");
        res.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
        res.setHeader("Pragma", "public");
        //
        // setting the content type
        res.setHeader("Content-Disposition", " attachment; filename=" + filename);
        res.setContentType("application/pdf");
        //
        // the contentlength is needed for MSIE!!!
        res.setContentLength(baos.size());
        //
        out = res.getOutputStream();
        if (out != null) {
            baos.writeTo(out);
        }
    } catch (Exception ex) {
        System.err.println(ex);
    }
}

From source file:com.bibisco.export.ITextExporter.java

License:GNU General Public License

private void initFont(RichTextEditorSettings pRichTextEditorSettings) {
    mFont = new Font();

    if (pRichTextEditorSettings.getFont().equals("courier")) {
        mFont = new Font(Font.COURIER);
    } else if (pRichTextEditorSettings.getFont().equals("times")) {
        mFont = new Font(Font.TIMES_ROMAN);
    } else if (pRichTextEditorSettings.getFont().equals("arial")) {
        mFont = new Font(Font.HELVETICA);
    }//from  w ww  .  j ava  2  s.  c  o m

    mFont.setSize(12);
}

From source file:com.ev.export.AnnualPDFExporter.java

License:Apache License

private void addHeading() throws Exception {
    Element elem = new Paragraph("Energieverbrauch " + year, new Font(Font.TIMES_ROMAN, 24));
    document.add(elem);//from ww  w .  j  av  a2 s .  c  om
}

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   ww w.j av  a 2 s  .c  om
    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 .  java 2s .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);

    }

}

From source file:com.sumeet.kraiglist.pdfview.PdfReportView.java

@Override
protected void buildPdfDocument(Map<String, Object> model, Document pdfdoc, PdfWriter pdfwriter,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    HttpSession session = request.getSession();
    String name = (String) session.getAttribute("firstname");
    if (name == null) {
        name = "";
    }// w  w  w  . j a  v  a2 s. co m

    Font font_helvetica_12_normal_black = new Font(Font.HELVETICA, 12, Font.NORMAL, Color.BLACK);
    Font font_courier_16_italic_blue = new Font(Font.COURIER, 10, Font.ITALIC, Color.BLUE);
    Font font_courier_16_italic_red = new Font(Font.COURIER, 16, Font.ITALIC, Color.BLUE);
    Font font_times_16_bold_green = new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, Color.BLACK);

    Paragraph prg0 = new Paragraph(
            "                                             Terms of Use of MyNEU KRAIGLIST",
            font_helvetica_12_normal_black);
    Paragraph prg1 = new Paragraph(
            "____________________________________________________________________________________________________________",
            font_courier_16_italic_red);
    Paragraph prg2 = new Paragraph("");
    Chunk c1 = new Chunk("Hello " + name + ",", font_courier_16_italic_blue);
    Paragraph prg3 = new Paragraph("PRODUCT SALES : "
            + "The GSI Products listed on this Site are offered for sale solely pursuant to GSIs standard terms and conditions of sale applicable"
            + "to such products. The terms and conditions are accessible for viewing by clicking on the link on each product line home page."
            + "GSI objects to and rejects any other terms that may be proposed by any customer or potential customer. No offers to sell or purchase"
            + "GSI products are valid and binding on GSI unless and until specifically accepted, in writing, by GSI.",
            font_times_16_bold_green);
    //Phrase phr2 = new Phrase("Phrase 2", font_helvetica_16_normal_blue);
    Paragraph prg4 = new Paragraph("");
    Paragraph prg5 = new Paragraph("LICENSE TO USE THIS SITE : "
            + "We at the GSI Group Inc. and its subsidiaries (GSI) are happy to have you as a visitor. We have established the following"
            + "terms and conditions, including our Privacy Statement, as a requirement for visitors using our site. In order to use our site, you"
            + "must agree to these terms and conditions (Terms). BY CHOOSING TO ACCESS AND USE THIS SITE, YOU ARE EXPRESSLY"
            + "AGREEING TO BE LEGALLY BOUND BY THESE TERMS. IF YOU DO NOT AGREE, DO NOT USE OR VIEW THE SITE."
            + "These Terms apply only to the use of this Site and do not supercede any other contractual agreement between you and GSI."
            + "Use of Materials: Upon your agreement to the Terms, GSI grants you the right to view the site and to download materials from"
            + "this site for your personal, non-commercial use. You are not authorized to use the materials for any other purpose. If you do"
            + "download or otherwise reproduce the materials from this Site, you must reproduce all of GSIs proprietary markings, such as"
            + "copyright and trademark notices, in the same form and manner as the original."
            + "Private Pages: Some parts of this Site are not available to the general public, but only to certain business associates of GSI."
            + "These sections may only be accessed by authorized entities and are controlled by password-protected access. If you are not"
            + "authorized to use these sections, then you agree that you will not attempt to gain access. If you are authorized, then by accessing"
            + "those areas, you expressly agree to the supplemental terms that are posted as part of the access process."
            + "No Harmful Use: In exchange for our permission to use this Site, you agree that you will not do anything to harm the functioning"
            + "or content of the Site. You will not attempt to upload, insert or change any information or image to or on this Site, except for providing"
            + "information where prompted by the Site. You agree that you will not take any action that imposes an unreasonably or disproportionately"
            + "large load on the Site or interferes with its functioning. You also agree that you will not use any false identity"
            + "when interacting with the Site, or do anything that is fraudulent, obscene, libelous or legally prohibited."
            + "You may not use any deep-link, page-scrape, robot, spider or any other automatic device, program, algorithm or methodology"
            + "or any similar or equivalent manual process to access, acquire, copy or monitor any portion of the Site or any of its content,"
            + "or in any way reproduce or circumvent the navigational structure or presentation of the Site."
            + "INDEMNITY: YOU AGREE THAT YOU WILL DEFEND, INDEMNIFY AND HOLD HARMLESS GSI, ITS CUSTOMERS, SUPPLIERS"
            + "AND JOINT VENTURE PARTNERS AND THEIR RESPECTIVE EMPLOYEES, OFFICERS, DIRECTORS, CONTRACTORS,"
            + "VENDORS, ASSIGNEES AND AGENTS FOR AND AGAINST ANY COSTS, CLAIMS, DAMAGES, LOSSES, OR"
            + "OTHER LIABILITIES ARISING FROM YOUR USE OF THE SITE IN BREACH OF THESE TERMS OR IN VIOLATION OF THE"
            + "LAW. IF GSI TAKES ANY LEGAL ACTION AGAINST YOU AS A RESULT OF YOUR VIOLATION OF THESE TERMS, YOU"
            + "AGREE THAT YOU WILL BE RESPONSIBLE FOR AND WILL PAY ALL OF GSIS LEGAL FEES IN CONNECTION WITH"
            + "SUCH ACTION. ", font_times_16_bold_green);

    pdfdoc.add(c1);
    pdfdoc.add(prg0);
    pdfdoc.add(prg1);
    pdfdoc.add(prg2);
    pdfdoc.add(prg3);
    pdfdoc.add(prg4);
    pdfdoc.add(prg5);

}

From source file:com.tsp.gespro.bo.DegustacionBO.java

/**
 * Representacin impresa PDF//from w  w w  . ja  v a  2s  .  c  om
 */
public ByteArrayOutputStream toPdf(UsuarioBO user) throws Exception {

    SimpleDateFormat fecha = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat hora = new SimpleDateFormat("HH:mm:ss");
    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    PdfITextUtil obj = new PdfITextUtil();

    //Tamao de documento (Tamao Carta)
    com.lowagie.text.Document doc = new com.lowagie.text.Document(PageSize.LETTER);

    //Definicin de Fuentes a usar
    Font letraOcho = new Font(Font.HELVETICA, 8, Font.NORMAL);
    Font letraOchoBold = new Font(Font.HELVETICA, 8, Font.BOLD);
    Font letraNueve = new Font(Font.HELVETICA, 9, Font.NORMAL);
    Font letraNueveBold = new Font(Font.HELVETICA, 9, Font.BOLD);
    Font letraNueveBoldRojo = new Font(Font.TIMES_ROMAN, 9, Font.BOLD, Color.red);
    Font letraNueveBoldAzul = new Font(Font.TIMES_ROMAN, 9, Font.BOLD, Color.blue);
    Font letraOchoVerde = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL, Color.green);
    Font letra14Bold = new Font(Font.HELVETICA, 14, Font.BOLD);

    String msgError = "";

    File fileImageLogo = null;
    try {
        if (user != null)
            fileImageLogo = new ImagenPersonalBO(this.conn)
                    .getFileImagenPersonalByEmpresa(user.getUser().getIdEmpresa());
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    try {
        //Preparamos writer de PDF
        PdfWriter writer = PdfWriter.getInstance(doc, baos);
        EventPDF eventPDF = new EventPDF(doc, user, ReportBO.DEGUSTACION_REPRESENTACION_IMPRESA, fileImageLogo);
        writer.setPageEvent(eventPDF);

        //Ajustamos margenes de pgina
        //doc.setMargins(50, 50, 120, 50);
        //doc.setMargins(20, 20, 80, 20);
        doc.setMargins(10, 10, 150, 40);

        //Iniciamos documento
        doc.open();

        //Creamos tabla principal
        PdfPTable mainTable = new PdfPTable(1);
        mainTable.setTotalWidth(550);
        mainTable.setLockedWidth(true);

        //CONTENIDO -------------

        //SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        //Cabecera (Datos Generales)---------------------
        PdfPTable tAux = new PdfPTable(1);

        Cliente clienteDto = null;
        DatosUsuario datosUsuarioVendedor = null;

        try {
            if (this.degustacion.getIdCliente() > 0)
                clienteDto = new ClienteBO(this.degustacion.getIdCliente(), this.conn).getCliente();
            if (this.degustacion.getIdUsuario() > 0)
                datosUsuarioVendedor = new UsuarioBO(this.degustacion.getIdUsuario()).getDatosUsuario();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        //Datos informativos generales
        PdfPTable tInfoGeneral = new PdfPTable(1);
        tInfoGeneral.setTotalWidth(160);
        tInfoGeneral.setLockedWidth(true);

        obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "ID Degustacin",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueveBoldRojo, "" + this.degustacion.getIdDegustacion(),
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);

        obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "Fecha Degustacin",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueve,
                DateManage.dateToStringEspanol(this.degustacion.getFechaApertura()),
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "Promotor",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueve,
                datosUsuarioVendedor != null
                        ? (datosUsuarioVendedor.getNombre() + " " + datosUsuarioVendedor.getApellidoPat())
                        : "Sin vendedor asignado",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);

        //Pintamos datos informativos Generales en la esquina superior derecha
        PdfContentByte cb = writer.getDirectContent();
        tInfoGeneral.writeSelectedRows(0, -1, doc.right() - 180, doc.top() + 100, cb);

        //Datos de Cliente/Prospecto
        PdfPTable tCliente = new PdfPTable(2);
        tCliente.setTotalWidth(550);
        tCliente.setLockedWidth(true);

        obj.agregaCelda(tCliente, letraNueveBold, Color.lightGray, "Cliente",
                new boolean[] { false, false, false, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 2);

        tAux = new PdfPTable(1);
        tAux.setTotalWidth(275);
        tAux.setLockedWidth(true);

        try {
            obj.agregaCelda(tAux, letraOcho,
                    "Nombre Comercial: " + (clienteDto != null ? clienteDto.getNombreComercial() : ""),
                    new boolean[] { false, true, false, false }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0,
                    new int[0], 1);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        obj.agregaTabla(tCliente, tAux, new boolean[] { false, false, false, false }, Element.ALIGN_LEFT,
                Element.ALIGN_TOP, 0, new int[0], 1);

        obj.agregaCelda(tCliente, letraOcho,
                "" + "DOMICILIO: \n" + (clienteDto != null ? "Calle: " + clienteDto.getCalle() : "") + " "
                        + (clienteDto != null ? clienteDto.getNumero() : "") + " "
                        + (clienteDto != null ? clienteDto.getNumeroInterior() : "")
                        + (clienteDto != null ? " Col: " + clienteDto.getColonia() : "")
                        + (clienteDto != null ? " \nDeleg./Municipio: " + clienteDto.getMunicipio() : "")
                        + (clienteDto != null ? " Estado: " + clienteDto.getEstado() : "")
                        + (clienteDto != null ? " \nC.P. " + clienteDto.getCodigoPostal() : ""),
                new boolean[] { false, true, false, true }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0,
                new int[0], 1);

        obj.agregaTabla(mainTable, tCliente, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER,
                Element.ALIGN_TOP, 0, new int[0], 1);

        //FIN Cabecera (Datos Generales)-----------------

        //DOBLE SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        int colsDetalles = 6;
        PdfPTable tDetalles = new PdfPTable(colsDetalles);//6);
        tDetalles.setTotalWidth(550);
        tDetalles.setWidths(new int[] { 200, 70, 70, 70, 70, 70 });
        tDetalles.setLockedWidth(true);

        /*CABECERA*/
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Producto Degustado",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Hr Inicio",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Hr Termino",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Inventario Inicial",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Inventario Final",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Piezas Degustadas",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);

        /*FIN DE CABECERA*/
        Degustacion[] degustacionDtos = new Degustacion[0];
        try {
            degustacionDtos = this.findDegustaciones(this.degustacion.getIdDegustacion(),
                    this.degustacion.getIdEmpresa(), -1, -1, "");
        } catch (Exception e) {
        }

        //Listado de Productos
        for (Degustacion item : degustacionDtos) {

            if (item != null) {

                Concepto conceptoDto = null;

                try {
                    ConceptoBO conceptoBO = new ConceptoBO(item.getIdConcepto(), this.conn);
                    conceptoDto = conceptoBO.getConcepto();
                } catch (Exception e) {
                }

                //Producto
                obj.agregaCelda(tDetalles, letraOcho, null, conceptoDto.getNombreDesencriptado(),
                        new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP,
                        15, new int[] { 5, 5, 5, 5 }, 1);

                //Inicio
                obj.agregaCelda(tDetalles, letraOcho, null, hora.format(item.getFechaApertura()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP,
                        15, new int[] { 5, 5, 5, 5 }, 1);

                //Termino
                obj.agregaCelda(tDetalles, letraOcho, null, hora.format(item.getFechaCierre()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

                //Inv inicial 
                obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidad()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

                //inv final 
                obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidadCierre()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

                //Piezas 
                obj.agregaCelda(tDetalles, letraOcho, null,
                        "" + (item.getCantidad() - item.getCantidadCierre()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

            }
        }

        obj.agregaTabla(mainTable, tDetalles, new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_TOP, 0, new int[0], 1);

        //DOBLE SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        /*prods Vendidos durante degustacion*/

        PdfPTable tVenta = new PdfPTable(4);
        tVenta.setTotalWidth(550);
        tVenta.setWidths(new int[] { 70, 140, 170, 120 });
        tVenta.setLockedWidth(true);

        obj.agregaCelda(tVenta, letraNueveBold, Color.lightGray, "Producto Vendido durante Degutacin",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 4);

        Productosvendidos[] pedidoProductoDto = new Productosvendidos[0];

        String filtroBusqueda = " ID_PEDIDO IN ( SELECT ID_PEDIDO FROM sgfens_pedido WHERE ID_EMPRESA = '"
                + this.degustacion.getIdEmpresa() + "' AND ID_TIPO_PEDIDO = 2 AND ID_USUARIO_VENDEDOR = "
                + this.degustacion.getIdUsuario() + " AND " + " ID_ESTATUS_PEDIDO<>2 AND FECHA_PEDIDO BETWEEN '"
                + this.degustacion.getFechaApertura() + "'  AND '" + this.degustacion.getFechaCierre() + "') ";

        try {
            pedidoProductoDto = new ProductosvendidosDaoImpl().findByDynamicWhere(filtroBusqueda, null);
        } catch (Exception e) {
        }

        if (pedidoProductoDto.length > 0) {

            obj.agregaCelda(tVenta, letraOchoBold, null, "Cdigo", new boolean[] { true, true, true, true },
                    Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1);
            obj.agregaCelda(tVenta, letraOchoBold, null, "Nombre", new boolean[] { true, true, true, true },
                    Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1);
            obj.agregaCelda(tVenta, letraOchoBold, null, "Descripcin",
                    new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                    new int[] { 5, 5, 5, 5 }, 1);
            obj.agregaCelda(tVenta, letraOchoBold, null, "Unidades Vendidas",
                    new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                    new int[] { 5, 5, 5, 5 }, 1);

            for (Productosvendidos pedidoProd : pedidoProductoDto) {

                if (pedidoProd != null) {

                    Concepto conceptoDto = null;
                    try {
                        ConceptoBO conceptoBO = new ConceptoBO(pedidoProd.getIdConcepto(), this.conn);
                        conceptoDto = conceptoBO.getConcepto();
                    } catch (Exception e) {
                    }

                    //Cdigo
                    obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getIdentificacion(),
                            new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED,
                            Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1);

                    //Nombre
                    obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getNombreDesencriptado(),
                            new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED,
                            Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1);

                    //Descripcin
                    obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getDescripcion(),
                            new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP,
                            15, new int[] { 5, 5, 5, 5 }, 1);

                    //Unidades Vendidas 
                    obj.agregaCelda(tVenta, letraOcho, null, "" + (pedidoProd.getCantidad()),
                            new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP,
                            15, new int[] { 5, 5, 5, 5 }, 1);

                }

            }
        } else {

            obj.agregaCelda(tVenta, letraOcho, null, "No se registrarn datos.",
                    new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                    new int[] { 5, 5, 5, 5 }, 4);

        }

        obj.agregaTabla(mainTable, tVenta, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER,
                Element.ALIGN_TOP, 0, new int[0], 1);

        //DOBLE SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        /*Comentarios Adicionales*/
        PdfPTable tComenst = new PdfPTable(1);
        tComenst.setTotalWidth(550);
        tComenst.setWidths(new int[] { 550 });
        tComenst.setLockedWidth(true);

        obj.agregaCelda(tComenst, letraNueveBold, Color.lightGray, "Comentarios",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 2);

        obj.agregaCelda(tComenst, letraOcho, null, this.degustacion.getComentariosCierre(),
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 2);

        obj.agregaTabla(mainTable, tComenst, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER,
                Element.ALIGN_TOP, 0, new int[0], 1);

        //FIN DE CONTENIDO --------

        //Aadimos tabla principal construida al documento
        doc.add(mainTable);
        mainTable.flushContent();

    } catch (Exception ex) {
        msgError = "No se ha podido generar la representacin impresa de la Degustacion en formato PDF:<br/>"
                + ex.toString();
    } finally {
        if (doc.isOpen())
            doc.close();
    }

    if (!msgError.equals("")) {
        throw new Exception(msgError);
    }

    return baos;

}