Example usage for com.lowagie.text Font ITALIC

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

Introduction

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

Prototype

int ITALIC

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

Click Source Link

Document

this is a possible style.

Usage

From source file:com.concursive.connect.web.modules.wiki.utils.WikiPDFUtils.java

License:Open Source License

private static boolean parseLine(WikiPDFContext context, String line, Paragraph main, Connection db,
        ArrayList<Integer> wikiListTodo, float cellWidth, PdfPCell cell) throws Exception {

    LOG.debug("PARSING LINE: " + line);

    // Context Objects
    Project project = context.getProject();
    WikiExportBean exportBean = context.getExportBean();
    HashMap<String, ImageInfo> imageList = context.getImageList();
    String fileLibrary = context.getFileLibrary();

    boolean needsCRLF = true;
    boolean bold = false;
    boolean italic = false;
    boolean bolditalic = false;
    StringBuffer subject = new StringBuffer();
    StringBuffer data = new StringBuffer();
    int linkL = 0;
    int linkR = 0;
    int attr = 0;
    int underlineAttr = 0;

    // parse characters
    for (int i = 0; i < line.length(); i++) {
        char c1 = line.charAt(i);
        String c = String.valueOf(c1);
        // False attr/links
        if (!"'".equals(c) && attr == 1) {
            data.append("'").append(c);
            attr = 0;/* ww  w .  j  a v  a  2 s .c o m*/
            continue;
        }
        if (!"_".equals(c) && underlineAttr == 1) {
            data.append("_").append(c);
            underlineAttr = 0;
            continue;
        }
        if (!"[".equals(c) && linkL == 1) {
            data.append("[").append(c);
            linkL = 0;
            continue;
        }
        if (!"]".equals(c) && linkR == 1) {
            data.append("]").append(c);
            linkR = 0;
            continue;
        }
        // Links
        if ("[".equals(c)) {
            ++linkL;
            continue;
        }
        if ("]".equals(c)) {
            ++linkR;
            if (linkL == 2 && linkR == 2) {
                LOG.debug("main.add(new Chunk(data.toString()))");
                main.add(new Chunk(data.toString()));
                data.setLength(0);
                // Different type of links...
                String link = subject.toString().trim();
                if (link.startsWith("Image:") || link.startsWith("image:")) {
                    // @note From WikiImageLink.java
                    String image = link.substring(6);
                    String title = null;
                    int frame = -1;
                    int thumbnail = -1;
                    int left = -1;
                    int right = -1;
                    int center = -1;
                    int none = -1;
                    int imageLink = -1;
                    int alt = -1;
                    if (image.indexOf("|") > 0) {
                        // the image is first
                        image = image.substring(0, image.indexOf("|"));
                        // any directives are next
                        frame = link.indexOf("|frame");
                        thumbnail = link.indexOf("|thumb");
                        left = link.indexOf("|left");
                        right = link.indexOf("|right");
                        center = link.indexOf("|center");
                        none = link.indexOf("|none");
                        imageLink = link.indexOf("|link=");
                        alt = link.indexOf("|alt=");
                        // the optional caption is last
                        int last = link.lastIndexOf("|");
                        if (last > frame && last > thumbnail && last > left && last > right && last > center
                                && last > none && last > imageLink && last > alt) {
                            title = link.substring(last + 1);
                        }
                    }

                    //A picture, including alternate text:
                    //[[Image:Wiki.png|The logo for this Wiki]]

                    //You can put the image in a frame with a caption:
                    //[[Image:Wiki.png|frame|The logo for this Wiki]]

                    // Access some image details
                    int width = 0;
                    int height = 0;
                    ImageInfo imageInfo = imageList.get(image + (thumbnail > -1 ? "-TH" : ""));
                    if (imageInfo != null) {
                        width = imageInfo.getWidth();
                        height = imageInfo.getHeight();
                    }

                    // Alt
                    String altText = null;
                    if (alt > -1) {
                        int startIndex = alt + 4;
                        int endIndex = link.indexOf("|", startIndex);
                        if (endIndex == -1) {
                            endIndex = link.length();
                        }
                        altText = link.substring(startIndex, endIndex);
                    }

                    // Looks like the image needs a link (which is always last)
                    String url = null;
                    if (imageLink > -1) {
                        // Get the entered link
                        int startIndex = imageLink + 6;
                        int endIndex = link.length();
                        String href = link.substring(startIndex, endIndex);

                        // Treat as a wikiLink to validate and to create a proper url
                        WikiLink wikiLink = new WikiLink(project.getId(),
                                (altText != null ? href + " " + altText : href));
                        url = wikiLink.getUrl("");
                        if (!url.startsWith("http://") && !url.startsWith("https://")) {
                            // @todo Use a local link
                            // @todo Use an external link
                        }
                    }

                    // Determine if local or external image
                    if ((image.startsWith("http://") || image.startsWith("https://"))) {
                        // retrieve external image
                        String imageUrl = null;
                        try {
                            URL imageURL = new URL(image);
                            imageUrl = image;
                        } catch (Exception e) {

                        }
                    } else {
                        // local image
                        try {
                            // @todo image alignment and links
                            Image thisImage = Image.getInstance(
                                    getImageFilename(db, fileLibrary, project, image, (thumbnail > -1)));

                            LOG.debug("Drawing image for area: " + cellWidth);

                            if (cellWidth > 0f) {
                                LOG.debug(" Image is embedded in cell");
                                // Guess the size of the cell
                                float cellPixels = (500f * (cellWidth / 100f));
                                if (cellPixels > 0f && (float) width > cellPixels) {
                                    // Shrink image to fit the cell
                                    LOG.debug(" Scaling to fit");
                                    thisImage.scaleToFit(cellPixels, 500f);
                                } else {
                                    // Align image to left instead of scaling it to fit
                                    thisImage.setAlignment(Image.LEFT);
                                }
                                LOG.debug("cell.addElement(thisImage)");
                                cell.addElement(thisImage);
                            } else {
                                LOG.debug(" Image is inline");
                                if (width > 500) {
                                    LOG.debug(" Scaling to fit");
                                    thisImage.scaleToFit(500f, 500f);
                                }
                                LOG.debug("main.add(thisImage)");
                                main.add(thisImage);
                            }

                            //                thisImage.setAlignment();
                            //                thisImage.Alignment = Image.TEXTWRAP | Image.ALIGN_RIGHT;

                            //                main.add(thisImage);
                        } catch (FileNotFoundException fnfe) {
                            LOG.warn("WikiPDFUtils-> Image was not found in the FileLibrary ("
                                    + getImageFilename(db, fileLibrary, project, image, (thumbnail > -1))
                                    + ")... will continue.");
                        }
                    }

                    /*
                    if (frame > -1 || thumbnail > -1) {
                      sb.append("</div>");
                      sb.append("<div id=\"caption\" style=\"margin-bottom: 5px; margin-left: 5px; margin-right: 5px; text-align: left;\">");
                    }
                    if (thumbnail > -1) {
                      sb.append("<div style=\"float:right\"><a target=\"_blank\" href=\"ProjectManagementWiki.do?command=Img&pid=" + wiki.getProjectId() + "&subject=" + StringUtils.replace(StringUtils.jsEscape(image), "%20", "+") + "\"><img src=\"images/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"Enlarge\" border=\"0\" /></a></div>");
                    }
                    if (frame > -1 || thumbnail > -1) {
                      if (title != null) {
                        sb.append(StringUtils.toHtml(title));
                      }
                      sb.append(
                          "  </div>\n" +
                              "</div>");
                    }
                    */
                    /*
                    if (none > -1) {
                      sb.append("<br clear=\"all\">");
                    }
                    */
                    if (i + 1 == line.length() && (right > -1 || left > -1) || none > -1) {
                        needsCRLF = false;
                    }
                } else {
                    // This is most likely a Wiki link
                    String title = subject.toString().trim();
                    if (link.indexOf("|") > 0) {
                        link = link.substring(0, link.indexOf("|")).trim();
                        title = title.substring(title.indexOf("|") + 1);
                    }
                    if (link.indexOf("http://") > -1 || link.indexOf("https://") > -1) {
                        String label = link;
                        if (link.indexOf(" ") > 0) {
                            label = link.substring(link.indexOf(" ") + 1);
                            link = link.substring(0, link.indexOf(" "));
                        }
                        Anchor anchor1 = new Anchor(label, FontFactory.getFont(FontFactory.HELVETICA, 12,
                                Font.UNDERLINE, new Color(0, 0, 255)));
                        anchor1.setReference(link);
                        anchor1.setName("top");
                        main.add(anchor1);
                    } else {
                        // Place a wiki link
                        if (exportBean.getFollowLinks()) {
                            // See if target link exists before creating a link to it
                            int linkedWikiId = -1;
                            if (StringUtils.hasText(title) && !title.startsWith("|")) {
                                Wiki subwiki = WikiList.queryBySubject(db, title, project.getId());
                                if (subwiki.getId() > -1) {
                                    linkedWikiId = subwiki.getId();
                                }
                            }
                            // Display the linked item
                            if (linkedWikiId > -1) {
                                // Display as an anchor
                                Anchor linkToWiki = new Anchor(title, FontFactory.getFont(FontFactory.HELVETICA,
                                        12, Font.NORMAL, new Color(0, 0, 255)));
                                linkToWiki.setReference("#" + title.toLowerCase());
                                LOG.debug("Link to: #" + title.toLowerCase());
                                main.add(linkToWiki);
                                LOG.debug(" main.add(linkToWiki)");
                                //                  main.add(new Chunk(title, FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255))).setLocalGoto(link));
                                // Add this wiki to the to do list...
                                if (!wikiListTodo.contains(linkedWikiId)) {
                                    wikiListTodo.add(linkedWikiId);
                                }
                            } else {
                                // Display without the link
                                main.add(new Chunk(title, FontFactory.getFont(FontFactory.HELVETICA, 12,
                                        Font.NORMAL, new Color(0, 0, 255))));
                            }
                        } else {
                            // Not following links, so display... perhaps as an external link someday
                            main.add(new Chunk(title, FontFactory.getFont(FontFactory.HELVETICA, 12,
                                    Font.NORMAL, new Color(0, 0, 255))));
                        }
                    }
                }
                subject.setLength(0);
                linkL = 0;
                linkR = 0;
            }
            continue;
        }
        if (!"[".equals(c) && linkL == 2 && !"]".equals(c)) {
            subject.append(c);
            continue;
        }
        // Attribute properties
        if ("'".equals(c)) {
            ++attr;
            continue;
        }
        if (!"'".equals(c) && attr > 1) {
            if (attr == 2) {
                if (!italic) {
                    main.add(new Chunk(data.toString()));
                    data.setLength(0);
                    data.append(c);
                    italic = true;
                } else {
                    data.append(c);
                    main.add(new Chunk(data.toString(),
                            FontFactory.getFont(FontFactory.HELVETICA, 12, Font.ITALIC, new Color(0, 0, 0))));
                    data.setLength(0);
                    italic = false;
                }
                attr = 0;
                continue;
            }
            if (attr == 3) {
                if (!bold) {
                    main.add(new Chunk(data.toString()));
                    data.setLength(0);
                    data.append(c);
                    bold = true;
                } else {
                    data.append(c);
                    main.add(new Chunk(data.toString(),
                            FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, new Color(0, 0, 0))));
                    data.setLength(0);
                    bold = false;
                }
                attr = 0;
                continue;
            }
            if (attr == 5) {
                if (!bolditalic) {
                    main.add(new Chunk(data.toString()));
                    data.setLength(0);
                    data.append(c);
                    bolditalic = true;
                } else {
                    data.append(c);
                    main.add(new Chunk(data.toString(), FontFactory.getFont(FontFactory.HELVETICA, 12,
                            Font.BOLDITALIC, new Color(0, 0, 0))));
                    data.setLength(0);
                    bolditalic = false;
                }
                attr = 0;
                continue;
            }
        }
        data.append(c);
    }
    for (int x = 0; x < linkR; x++) {
        data.append("]");
    }
    for (int x = 0; x < linkL; x++) {
        data.append("[");
    }
    if (attr == 1) {
        data.append("'");
    }
    if (italic) {
        main.add(new Chunk(data.toString(),
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.ITALIC, new Color(0, 0, 0))));
    } else if (bold) {
        main.add(new Chunk(data.toString(),
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, new Color(0, 0, 0))));
    } else if (bolditalic) {
        main.add(new Chunk(data.toString(),
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLDITALIC, new Color(0, 0, 0))));
    } else {
        main.add(new Chunk(data.toString()));
    }
    data.setLength(0);
    return needsCRLF;
}

From source file:com.dlya.facturews.DlyaPdfExporter2.java

License:Open Source License

/**
 * Creates a PDF font./*w w w  . j a v a2s .  com*/
 * 
 * @param attributes the text attributes of the font
 * @param locale the locale for which to create the font
 * @param setFontLines whether to set underline and strikethrough as font style
 * @return the PDF font for the specified attributes
 */
@SuppressWarnings("deprecation")
protected Font getFont(Map<Attribute, Object> attributes, Locale locale, boolean setFontLines) {
    JRFont jrFont = new JRBaseFont(attributes);

    Exception initialException = null;

    Color forecolor = (Color) attributes.get(TextAttribute.FOREGROUND);

    // use the same font scale ratio as in JRStyledText.getAwtAttributedString
    float fontSizeScale = 1f;
    Integer scriptStyle = (Integer) attributes.get(TextAttribute.SUPERSCRIPT);
    if (scriptStyle != null && (TextAttribute.SUPERSCRIPT_SUB.equals(scriptStyle)
            || TextAttribute.SUPERSCRIPT_SUPER.equals(scriptStyle))) {
        fontSizeScale = 2f / 3;
    }

    Font font = null;
    PdfFont pdfFont = null;
    FontKey key = new FontKey(jrFont.getFontName(), jrFont.isBold(), jrFont.isItalic());

    if (fontMap != null && fontMap.containsKey(key)) {
        pdfFont = pdfFontMap.get(key);
    } else {
        FontInfo fontInfo = FontUtil.getInstance(jasperReportsContext).getFontInfo(jrFont.getFontName(),
                locale);
        if (fontInfo == null) {
            //fontName NOT found in font extensions
            pdfFont = new PdfFont(jrFont.getPdfFontName(), jrFont.getPdfEncoding(), jrFont.isPdfEmbedded());
        } else {
            //fontName found in font extensions
            FontFamily family = fontInfo.getFontFamily();
            FontFace face = fontInfo.getFontFace();
            int faceStyle = java.awt.Font.PLAIN;

            if (face == null) {
                //fontName matches family name in font extension
                if (jrFont.isBold() && jrFont.isItalic()) {
                    face = family.getBoldItalicFace();
                    faceStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
                }

                if (face == null && jrFont.isBold()) {
                    face = family.getBoldFace();
                    faceStyle = java.awt.Font.BOLD;
                }

                if (face == null && jrFont.isItalic()) {
                    face = family.getItalicFace();
                    faceStyle = java.awt.Font.ITALIC;
                }

                if (face == null) {
                    face = family.getNormalFace();
                    faceStyle = java.awt.Font.PLAIN;
                }

                //               if (face == null)
                //               {
                //                  throw new JRRuntimeException("Font family '" + family.getName() + "' does not have the normal font face.");
                //               }
            } else {
                //fontName matches face name in font extension; not family name
                faceStyle = fontInfo.getStyle();
            }

            String pdfFontName = null;
            int pdfFontStyle = java.awt.Font.PLAIN;
            if (jrFont.isBold() && jrFont.isItalic()) {
                pdfFontName = family.getBoldItalicPdfFont();
                pdfFontStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
            }

            if (pdfFontName == null && jrFont.isBold()) {
                pdfFontName = family.getBoldPdfFont();
                pdfFontStyle = java.awt.Font.BOLD;
            }

            if (pdfFontName == null && jrFont.isItalic()) {
                pdfFontName = family.getItalicPdfFont();
                pdfFontStyle = java.awt.Font.ITALIC;
            }

            if (pdfFontName == null) {
                pdfFontName = family.getNormalPdfFont();
                pdfFontStyle = java.awt.Font.PLAIN;
            }

            if (pdfFontName == null) {
                //in theory, face file cannot be null here
                pdfFontName = (face == null || face.getFile() == null ? jrFont.getPdfFontName()
                        : face.getFile());
                pdfFontStyle = faceStyle;//FIXMEFONT not sure this is correct, in case we inherit pdfFontName from default properties
            }

            //            String ttf = face.getFile();
            //            if (ttf == null)
            //            {
            //               throw new JRRuntimeException("The '" + face.getName() + "' font face in family '" + family.getName() + "' returns a null file.");
            //            }

            pdfFont = new PdfFont(pdfFontName,
                    family.getPdfEncoding() == null ? jrFont.getPdfEncoding() : family.getPdfEncoding(),
                    family.isPdfEmbedded() == null ? jrFont.isPdfEmbedded()
                            : family.isPdfEmbedded().booleanValue(),
                    jrFont.isBold() && ((pdfFontStyle & java.awt.Font.BOLD) == 0),
                    jrFont.isItalic() && ((pdfFontStyle & java.awt.Font.ITALIC) == 0));
        }
    }

    int pdfFontStyle = (pdfFont.isPdfSimulatedBold() ? Font.BOLD : 0)
            | (pdfFont.isPdfSimulatedItalic() ? Font.ITALIC : 0);
    if (setFontLines) {
        pdfFontStyle |= (jrFont.isUnderline() ? Font.UNDERLINE : 0)
                | (jrFont.isStrikeThrough() ? Font.STRIKETHRU : 0);
    }

    try {
        font = FontFactory.getFont(pdfFont.getPdfFontName(), pdfFont.getPdfEncoding(), pdfFont.isPdfEmbedded(),
                jrFont.getFontSize() * fontSizeScale, pdfFontStyle, forecolor);

        // check if FontFactory didn't find the font
        if (font.getBaseFont() == null && font.family() == Font.UNDEFINED) {
            font = null;
        }
    } catch (Exception e) {
        initialException = e;
    }

    if (font == null) {
        byte[] bytes = null;

        try {
            bytes = RepositoryUtil.getInstance(jasperReportsContext)
                    .getBytesFromLocation(pdfFont.getPdfFontName());
        } catch (JRException e) {
            throw //NOPMD
            new JRRuntimeException("Could not load the following font : " + "\npdfFontName   : "
                    + pdfFont.getPdfFontName() + "\npdfEncoding   : " + pdfFont.getPdfEncoding()
                    + "\nisPdfEmbedded : " + pdfFont.isPdfEmbedded(), initialException);
        }

        BaseFont baseFont = null;

        try {
            baseFont = BaseFont.createFont(pdfFont.getPdfFontName(), pdfFont.getPdfEncoding(),
                    pdfFont.isPdfEmbedded(), true, bytes, null);
        } catch (DocumentException e) {
            throw new JRRuntimeException(e);
        } catch (IOException e) {
            throw new JRRuntimeException(e);
        }

        font = new Font(baseFont, jrFont.getFontSize() * fontSizeScale, pdfFontStyle, forecolor);
    }

    return font;
}

From source file:com.gp.cong.logisoft.lcl.report.FreightInvoiceLclPdfCreator.java

public void init(String outputFileName, String fileId)
        throws FileNotFoundException, DocumentException, Exception {
    document = new Document(PageSize.A4);
    document.setMargins(10, 10, 10, 10);
    pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(outputFileName));
    pdfWriter.setPageEvent(new FreightInvoiceLclPdfCreator(realPath, fileId));
    company = new SystemRulesDAO().getCompanyDetails();
    this.setBrand(fileId);
    HeaderFooter footer = new HeaderFooter(
            new Phrase(companyName, new Font(Font.HELVETICA, 10, Font.ITALIC, Color.BLACK)), false);
    footer.setBorder(Rectangle.NO_BORDER);
    footer.setAlignment(Element.ALIGN_CENTER);
    document.setFooter(footer);//from   w  w w .j  ava2 s  .c o  m
    document.open();
}

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);//  w w  w  .j av a  2 s.co m
    int[] two = { 10, 90 };//sets the widths of the columns(2) with checkboxes

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

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

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

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

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

    document.add(spacer);

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

    document.add(spacer);

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

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

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

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

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

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

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

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

    document.add(table1);

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

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

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

    document.add(table1);

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

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

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

    document.add(table1);

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

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

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

        document.add(table1);

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

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

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

        document.add(table1);
    }

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

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

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

    document.add(table1);

}

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

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

    //for the unchecked box
    Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg");
    Chunk ch2 = new Chunk(checkbox, -7, -7);
    Phrase checkboxPhrase = new Phrase();
    checkboxPhrase.add(ch2);/*w  w  w.j  ava2  s  .c om*/

    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.stratelia.webactiv.kmelia.control.Callback.java

License:Open Source License

@Override
public void handleStartTag(Tag t, MutableAttributeSet a, int pos) throws KmeliaRuntimeException {
    SilverTrace.info("kmelia", "Callback.handleStartTag", "root.MSG_ENTRY_METHOD", "t = " + t.toString());
    if (TABLE.equals(t)) {
        try {//from w  w w .  j  a v a2s.  c  o m
            tbl = new Table(Integer.parseInt(columns.get(++current_table)));
            tbl.setBorderWidth(0);
            tbl.setAlignment(Element.ALIGN_LEFT);
            attribute = a.getAttribute(Attribute.WIDTH);
            if (attribute != null) {
                attribute_value = attribute.toString();
                if ("%".equals(attribute_value.substring(attribute_value.length() - 1))) {
                    tbl.setWidth(
                            (Integer.parseInt(attribute_value.substring(0, attribute_value.length() - 1))));
                }
            }
            attribute = a.getAttribute(Attribute.CELLPADDING);
            if (attribute != null) {
                attribute_value = attribute.toString();
                tbl.setSpacing(Integer.parseInt(attribute_value));
            }
            attribute = a.getAttribute(Attribute.CELLSPACING);
            if (attribute != null) {
                attribute_value = attribute.toString();
                tbl.setPadding(Integer.parseInt(attribute_value));
            }
        } catch (Exception ex) {
            throw new KmeliaRuntimeException("Callback.handleStartTag", SilverpeasRuntimeException.WARNING,
                    "kmelia.EX_CANNOT_SHOW_PDF_GENERATION", ex);
        }
    } else if (TD.equals(t)) {
        try {
            if (cl == null) {
                cl = new Cell();
                cl.setBorderWidth(0);
            }
            is_was_text = false;
        } catch (Exception ex) {
            throw new KmeliaRuntimeException("Callback.handleStartTag", SilverpeasRuntimeException.WARNING,
                    "kmelia.EX_CANNOT_SHOW_PDF_GENERATION", ex);
        }
    } else if (H1.equals(t)) {
        font_size = Font.DEFAULTSIZE + 1;
    } else if (H2.equals(t)) {
        font_size = Font.DEFAULTSIZE + 2;
    } else if (H3.equals(t)) {
        font_size = Font.DEFAULTSIZE + 3;
    } else if (H4.equals(t)) {
        font_size = Font.DEFAULTSIZE + 4;
    } else if (H5.equals(t)) {
        font_size = Font.DEFAULTSIZE + 5;
    } else if (H6.equals(t)) {
        font_size = Font.DEFAULTSIZE + 6;
    } else if (FONT.equals(t)) {
        attribute = a.getAttribute(Attribute.SIZE);
        if (attribute != null) {
            font_size = Integer.parseInt(attribute.toString()) + Font.DEFAULTSIZE - 1;
        }
    } else if (t.equals(B)) {
        font_properties = font_properties | Font.BOLD;
    } else if (t.equals(I)) {
        font_properties = font_properties | Font.ITALIC;
    } else if (t.equals(U)) {
        // current PDF package doesn't support it
    }
}

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 = "";
    }/*from ww  w . jav a 2 s  . com*/

    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:corner.orm.tapestry.jasper.exporter.CornerPdfExporter.java

License:Apache License

/**
 * ?,,./*from   w  w  w  . ja  v a 2 s .c o  m*/
 * @see net.sf.jasperreports.engine.export.JRPdfExporter#getFont(java.util.Map)
 */
protected Font getFont(Map attributes) {
    JRFont jrFont = new JRBaseFont(attributes);

    Exception initialException = null;

    Color forecolor = (Color) attributes.get(TextAttribute.FOREGROUND);
    /*
    if (forecolor == null)
    {
       forecolor = Color.black;
    }
    */

    Font font = null;
    PdfFont pdfFont = null;
    FontKey key = new FontKey(jrFont.getFontName(), jrFont.isBold(), jrFont.isItalic());

    if (fontMap != null && fontMap.containsKey(key)) {
        pdfFont = (PdfFont) fontMap.get(key);
    } else {
        pdfFont = new PdfFont(jrFont.getPdfFontName(), jrFont.getPdfEncoding(), jrFont.isPdfEmbedded(),
                jrFont.isBold(), jrFont.isItalic());
    }

    try {
        font = FontFactory.getFont(pdfFont.getPdfFontName(), pdfFont.getPdfEncoding(), pdfFont.isPdfEmbedded(),
                jrFont.getFontSize(),
                (pdfFont.isPdfSimulatedBold() ? Font.BOLD : 0)
                        | (pdfFont.isPdfSimulatedItalic() ? Font.ITALIC : 0)
                        | (jrFont.isUnderline() ? Font.UNDERLINE : 0)
                        | (jrFont.isStrikeThrough() ? Font.STRIKETHRU : 0),
                forecolor);

        // check if FontFactory didn't find the font
        if (font.getBaseFont() == null && font.family() == Font.UNDEFINED) {
            font = null;
        }
    } catch (Exception e) {
        initialException = e;
    }

    if (font == null) {
        byte[] bytes = null;

        try {
            bytes = JRLoader.loadBytesFromLocation(pdfFont.getPdfFontName(), classLoader, urlHandlerFactory);
        } catch (JRException e) {
            throw new JRRuntimeException("Could not load the following font : " + "\npdfFontName   : "
                    + pdfFont.getPdfFontName() + "\npdfEncoding   : " + pdfFont.getPdfEncoding()
                    + "\nisPdfEmbedded : " + pdfFont.isPdfEmbedded(), initialException);
        }

        BaseFont baseFont = null;

        try {
            baseFont = BaseFont.createFont(pdfFont.getPdfFontName(), pdfFont.getPdfEncoding(),
                    pdfFont.isPdfEmbedded(), true, bytes, null);
        } catch (DocumentException e) {
            throw new JRRuntimeException(e);
        } catch (IOException e) {
            throw new JRRuntimeException(e);
        }

        font = new Font(baseFont, jrFont.getFontSize(),
                ((pdfFont.isPdfSimulatedBold()) ? Font.BOLD : 0)
                        | ((pdfFont.isPdfSimulatedItalic()) ? Font.ITALIC : 0)
                        | (jrFont.isUnderline() ? Font.UNDERLINE : 0)
                        | (jrFont.isStrikeThrough() ? Font.STRIKETHRU : 0),
                forecolor);
    }

    return font;
}

From source file:de.unigoettingen.sub.commons.contentlib.pdflib.PDFTitlePage.java

License:Apache License

/************************************************************************************
 * render paragraph into title page/*from www .  j  a v a  2 s.co  m*/
 * 
 * @param pdftpp given {@link PDFTitlePageParagraph} to render
 * @param pdfdoc given {@link com.lowagie.text.Document} where to render
 * @throws DocumentException
 ************************************************************************************/
private void renderParagraph(PDFTitlePageParagraph pdftpp, com.lowagie.text.Document pdfdoc)
        throws DocumentException {
    String text = pdftpp.getContent();
    if (text == null) {
        text = "";
    }
    int fontstyle = Font.NORMAL;
    if (pdftpp.getFonttype().equals("bold")) {
        fontstyle = Font.BOLD;
    }
    if (pdftpp.getFonttype().equals("italic")) {
        fontstyle = Font.ITALIC;
    }
    if (pdftpp.getFonttype().equals("bolditalic")) {
        fontstyle = Font.BOLDITALIC;
    }
    if (pdftpp.getFonttype().equals("underline")) {
        fontstyle = Font.UNDERLINE;
    }
    if (pdftpp.getFonttype().equals("strikethru")) {
        fontstyle = Font.STRIKETHRU;
    }
    // create BaseFont for embedding
    try {
        Font font = FontFactory.getFont("Arial", BaseFont.CP1252, BaseFont.EMBEDDED, pdftpp.getFontsize(),
                fontstyle);
        Paragraph p2 = new Paragraph(new Chunk(text, font));
        // Paragraph p2=new Paragraph(text,
        // FontFactory.getFont(FontFactory.TIMES_ROMAN, 12));
        pdfdoc.add(p2);
    } catch (Exception e) {
        LOGGER.error("error occured while generating paragraph for titlepage", e);
    }
}

From source file:edu.csudh.goTorosBank.WithdrawServlet.java

public String writeIntoCheck(String filePath, String username, String theAmount, String amountInWords,
        String dateWrote, String person_payingto, String billType) throws IOException, NullPointerException {

    File blueCheck = new File("blank-blue-check.jpg");
    String pathToOriginal = getServletContext().getRealPath("/" + blueCheck);

    File file = new File(pathToOriginal);
    BufferedImage imageToCopy = null;
    try {//from  www . j  av a2  s . c o m
        imageToCopy = ImageIO.read(file);
    } catch (IOException e) {
        e.printStackTrace();
    }

    String amount = theAmount;
    String person_gettingPayed = person_payingto;
    String amountinWords = amountInWords;
    String date = dateWrote;
    String bill_type = billType;

    int w = imageToCopy.getWidth();
    int h = imageToCopy.getHeight();
    BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = img.createGraphics();
    g2d.setColor(g2d.getBackground());
    g2d.fillRect(0, 0, w, h);
    g2d.drawImage(imageToCopy, 0, -100, null);
    g2d.setPaint(Color.black);
    g2d.setFont(new java.awt.Font("Serif", Font.BOLD, 36));
    //g2d.setFont(new Font("Serif", Font.BOLD, 36));

    FontMetrics fm = g2d.getFontMetrics();
    int x = img.getWidth() - fm.stringWidth(amount) - 100;
    int y = fm.getHeight();
    g2d.drawString(amount, x - 70, y + 335);
    g2d.drawString(person_gettingPayed, x - 800, y + 329);
    g2d.drawString(amountinWords, x - 940, y + 390);
    g2d.drawString(date, x - 340, y + 245);
    g2d.drawString(bill_type, x - 900, y + 530);

    String signature = "Use The Force";
    g2d.setFont(new java.awt.Font("Monotype Corsiva", Font.BOLD | Font.ITALIC, 36));
    g2d.drawString(signature, x - 340, y + 530);
    g2d.dispose();
    /*write check to file*/
    String filename = fileNameGenerator(username);
    String fullname = filePath + "_" + filename + ".jpg";
    ImageIO.write(img, "jpg", new File(fullname));
    return fullname;
}