Example usage for com.itextpdf.text Font NORMAL

List of usage examples for com.itextpdf.text Font NORMAL

Introduction

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

Prototype

int NORMAL

To view the source code for com.itextpdf.text Font NORMAL.

Click Source Link

Document

this is a possible style.

Usage

From source file:com.dexter.fuelcard.mbean.UtilMBean.java

public byte[] createInvoicePDF(int pageType, String title, String dateperiod, String amount, String chargeType,
        String chargeAmount, String total) {
    try {//from   w  w w  . j av  a  2s  .  com
        Document document = new Document();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setPageEvent(new HeaderFooter());
        writer.setBoxSize("footer", new Rectangle(36, 54, 559, 788));
        if (!document.isOpen()) {
            document.open();
        }

        switch (pageType) {
        case 1:
            document.setPageSize(PageSize.A4);
            break;
        case 2:
            document.setPageSize(PageSize.A4.rotate());
            break;
        }
        document.addAuthor("FUELCARD");
        document.addCreationDate();
        document.addCreator("FUELCARD");
        document.addSubject("Invoice");
        document.addTitle(title);

        PdfPTable headerTable = new PdfPTable(1);

        ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext()
                .getContext();
        String logo = servletContext.getRealPath("") + File.separator + "resources" + File.separator + "images"
                + File.separator + "satraklogo.jpg";

        PdfPCell c = new PdfPCell(Image.getInstance(logo));
        c.setBorder(0);
        c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        headerTable.addCell(c);

        Paragraph stars = new Paragraph(20);
        stars.add(Chunk.NEWLINE);
        stars.setSpacingAfter(20);

        c = new PdfPCell(stars);
        c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        c.setBorder(0);
        headerTable.addCell(c);

        BaseFont helvetica = null;
        try {
            helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
        } catch (Exception e) {
            //font exception
        }
        Font font = new Font(helvetica, 16, Font.NORMAL | Font.BOLD);

        c = new PdfPCell(new Paragraph(title, font));
        c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        c.setBorder(0);
        headerTable.addCell(c);

        if (dateperiod != null) {
            stars = new Paragraph(20);
            stars.add(Chunk.NEWLINE);
            stars.setSpacingAfter(10);

            c = new PdfPCell(stars);
            c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            c.setBorder(0);
            headerTable.addCell(c);

            new Font(helvetica, 12, Font.NORMAL);
            Paragraph ch = new Paragraph("For " + dateperiod, font);
            c = new PdfPCell(ch);
            c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            headerTable.addCell(c);
        }
        stars = new Paragraph(20);
        stars.add(Chunk.NEWLINE);
        stars.setSpacingAfter(20);

        c = new PdfPCell(stars);
        c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        c.setBorder(0);
        headerTable.addCell(c);
        document.add(headerTable);

        PdfPTable pdfTable = new PdfPTable(4);
        try {
            helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
        } catch (Exception e) {
        }
        font = new Font(helvetica, 8, Font.BOLDITALIC);

        pdfTable.addCell(new Paragraph("Charge Type", font)); // % per transaction or flat per license
        pdfTable.addCell(new Paragraph("Charge Amount", font)); // the amount of the charge setting

        if (chargeType.equalsIgnoreCase("Percent-Per-Tran")) {
            pdfTable.addCell(new Paragraph("Total Amount", font)); // the amount of the charge setting
        } else {
            pdfTable.addCell(new Paragraph("Total License", font)); // the amount of the charge setting
        }
        //pdfTable.addCell(new Paragraph("Description", font)); // the 
        pdfTable.addCell(new Paragraph("Amount Due", font));

        font = new Font(helvetica, 8, Font.NORMAL);
        pdfTable.addCell(new Paragraph(chargeType, font));
        pdfTable.addCell(new Paragraph(chargeAmount, font));
        pdfTable.addCell(new Paragraph(total, font));
        pdfTable.addCell(new Paragraph(amount, font));

        pdfTable.setWidthPercentage(100);
        if (pdfTable != null)
            document.add(pdfTable);

        //Keep modifying your pdf file (add pages and more)

        document.close();

        return baos.toByteArray();
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.github.ossdevs.jhocr.converter.HocrPageProcessor.java

License:Open Source License

/**
 * TODO describe this method./*from   w  w  w  .j av a2  s  . co  m*/
 *
 * @param imageInputStream of the image.
 * @return true if the initialisation was successful.
 */
private boolean init(InputStream imageInputStream) {

    boolean result = false;

    try {

        /**
         * fontname the name of the font
         * encoding the encoding of the font
         * embedded true if the font is to be embedded in the PDF
         * size the size of this font
         * style the style of this font
         * color the BaseColor of this font.
         */
        font = FontFactory.getFont("/fonts/Sansation_Regular.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 0.8f,
                Font.NORMAL, BaseColor.BLACK);
        baseFont = font.getBaseFont();
        logger.trace("Loaded font: '{}'.", baseFont.getPostscriptFontName());

        byte[] bytes = new byte[imageInputStream.available()];

        imageInputStream.read(bytes);

        this.image = Image.getInstance(bytes);

        int dpiX, dpiY;

        /**
         * TODO add documentation, for example what if and what else
         */
        if (useImageDpi) {
            dpiX = getImage().getDpiX();
            if (dpiX == 0) {
                dpiX = DPI_DEFAULT;
            }
            dpiY = getImage().getDpiY();
            if (dpiY == 0) {
                dpiY = DPI_DEFAULT;
            }

        } else {
            dpiX = DPI_DEFAULT;
            dpiY = DPI_DEFAULT;
        }

        this.dotsPerPointX = dpiX / HocrToPdf.POINTS_PER_INCH;
        this.dotsPerPointY = dpiY / HocrToPdf.POINTS_PER_INCH;

        /**
         * TODO add documentation
         * TODO simplify this line, too many arguments.
         */
        this.imageRectangle = new Rectangle(getHocrPage().getBbox().getWidth() / getDotsPerPointX(),
                getHocrPage().getBbox().getHeight() / getDotsPerPointY());

        result = true;

    } catch (DocumentException e) {
        logger.error("Error while processing the document, please check th elog for more information.", e);
        result = false;
    } catch (IOException e) {
        logger.error("Error while processing the document, please check th elog for more information.", e);
        result = false;
    }

    return result;

}

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

public PdfPTable headerSection() throws Exception {
    Paragraph p = null;//from  w  w w.  j  av  a2  s .  com
    String companyName = "";
    Font blackArialFont20 = FontFactory.getFont("Arial", 20f, Font.NORMAL);
    table = new PdfPTable(3);
    table.setWidthPercentage(100f);
    cell = new PdfPCell();
    cell.setBorder(0);

    companyName = LoadLogisoftProperties
            .getProperty(ruleName.equalsIgnoreCase("ECU") ? "application.ECU.companyname"
                    : ruleName.equalsIgnoreCase("ECI") ? "application.Econo.companyname"
                            : ruleName.equalsIgnoreCase("OTI") ? "application.OTI.companyname"
                                    : "application.Econo.companyname");
    p = new Paragraph(2f, companyName.toUpperCase(), blackArialFont20);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(2f, this.headingAlert.equalsIgnoreCase("Y") ? "PRE-ALERT" : "", blackBoldFont14);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(2f, "BILL OF LADING", blackArialFont20);
    p.setAlignment(Element.ALIGN_RIGHT);
    cell.addElement(p);
    table.addCell(cell);
    //empty space
    table.addCell(createEmptyCell(0, 1f, 3));
    return table;
}

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

public PdfPTable addingCommodityValues() throws DocumentException, ParseException, Exception {
    Font font6 = new Font(FontFamily.COURIER, 6f, Font.BOLD);
    Font blackContentNormalFont8 = FontFactory.getFont("Arial", 8f, Font.NORMAL);
    Paragraph p = null;/*from  w w  w.j  av a  2s. c  o  m*/

    table = new PdfPTable(5);
    table.setWidthPercentage(100f);
    table.setWidths(new float[] { 2.74f, 1f, 6.33f, 1.40f, 1.40f });

    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setBorderWidthLeft(0.6f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    cell.setBorderWidthLeft(0.6f);
    p = new Paragraph(7f, " " + ipeHotCodeComments, blackContentNormalFont8);
    p.setAlignment(Element.ALIGN_LEFT);
    p.setSpacingAfter(2f);
    cell.addElement(p);
    p = new Paragraph(7f, "" + billingType, totalFontQuote);
    p.setAlignment(Element.ALIGN_CENTER);
    p.setSpacingAfter(2f);
    cell.addElement(p);

    if ("Y".equalsIgnoreCase(receiveKeyValue)) {
        p = new Paragraph(7f,
                "*** PLEASE NOTE THAT PAYMENT MUST BE RECEIVED PRIOR TO  ISSUING EXPRESS RELEASE / ORIGINAL HBL ***",
                blackContentNormalFont8);
        p.setAlignment(Element.ALIGN_LEFT);
        cell.addElement(p);
    }
    p = new Paragraph(7f,
            "I HEREBY DECLARE THAT THE ABOVE NAMED MATERIALS ARE PROPERLY CLASSIFIED," + "\n"
                    + "DESCRIBED,PACKAGED, MARKED, AND LABELED, AND ARE IN PROPER CONDITION FOR" + "\n"
                    + "TRANSPORTATION ACCORDING TO THE APPLICABLE REGULATIONS OF THE DEPARTMENT" + "\n"
                    + " OF TRANSPORTATION AND IMO.",
            font6);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    cell.setBorderWidthLeft(0.6f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setBorderWidthLeft(0.6f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(5);
    p = new Paragraph(7f,
            " Declared value per Package if value is More Than $500 Per Package USD___________________________",
            blackContentNormalFont8);
    p.setAlignment(Element.ALIGN_CENTER);
    p.setSpacingBefore(5f);
    cell.addElement(p);

    p = new Paragraph(7f,
            "These Commodities, Technology Or Software Were Exported From the United States in Accordance with the Export "
                    + "Administration Regulations.",
            blackContentNormalFont8);
    p.setSpacingBefore(5f);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);

    p = new Paragraph(7f, "Diversion Contrary To U.S. Law Prohibited.", blackContentNormalFont8);
    p.setSpacingBefore(3f);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);
    table.addCell(cell);
    return table;
}

From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java

public PdfPTable imageBlock(String realPath, String path)
        throws IOException, BadElementException, DocumentException {
    Font fontArialBold = FontFactory.getFont("Courier", 18f, Font.NORMAL);
    table = new PdfPTable(1);
    table.setWidths(new float[] { 5.9f });
    table.setWidthPercentage(100f);//from ww w.  j  ava 2 s  .c o m
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    Image img = Image.getInstance(realPath + path);
    img.scalePercent(90);
    img.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(img);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    p = new Paragraph(12f, "    (866) 326-6648", fontArialBold);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    String companyWebsite = new PropertyDAO().getProperty(
            companyCode.equalsIgnoreCase("03") ? "application.ECU.website" : "application.OTI.website");
    p = new Paragraph(28f, "   " + companyWebsite, fontArialBold);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);
    table.addCell(cell);
    return table;
}

From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java

public PdfPTable informationBlock(String companyName, String portofDischarge, String finalDestination)
        throws IOException, BadElementException, DocumentException {
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);//from   www .  j a  v  a2 s.c om
    Font fontArialNormal = FontFactory.getFont("Courier", 12f, Font.NORMAL);
    Font fontArialBold = FontFactory.getFont("Courier", 12f, Font.BOLD);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(5f, "To Name : " + companyName + "- Voyage Notice", fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(25f, "Company : " + companyName + ", INC", fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(25f, "Voyage Port of Discharge (POD) : " + portofDischarge, fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(9f, "Shipment Final Destination (FD) : " + finalDestination, fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);
    return table;
}

From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java

public PdfPCell allocateCell(String values, boolean border) {
    Font fontArialBold = FontFactory.getFont("Courier", 8f, Font.NORMAL);
    cell = new PdfPCell();
    cell.setBorder(0);// w  w  w.  j a v  a  2s .  c om
    p = new Paragraph(9f, values, fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    if (border) {
        cell.setBorderWidthRight(0.6f);
    }
    cell.addElement(p);
    return cell;
}

From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java

public PdfPTable changesBlock(LclSsDetail lclSsDetail, LclExportNotiFicationForm lclExportNotiFicationForm)
        throws IOException, BadElementException, DocumentException, Exception {
    table = new PdfPTable(2);
    table.setWidthPercentage(100f);/*from   w ww .j ava  2  s  .com*/
    Font fontArialNormal = FontFactory.getFont("Courier", 12f, Font.NORMAL);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(9f, "Voyage Information Was : ", fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    Date changedDatetime = lclExportNotiFicationForm.getEnterDateTime() != null
            ? lclExportNotiFicationForm.getEnterDateTime()
            : new Date();
    p = new Paragraph(9f, "Changes As Of:  " + DateUtils.formatDate(changedDatetime, "MM/dd/yyyy"),
            fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    cell.setBorderWidthBottom(0.6f);
    table.addCell(cell);
    if (lclSsDetail != null) {
        String stateValue = lclSsDetail.getDeparture().getStateId() != null
                ? lclSsDetail.getDeparture().getStateId().getCode()
                : "";
        String vessel = "", pier = "", portLrd = "", sail_date = "", eta_date = "", ss_line = "",
                ss_voyage = "";
        if (!"preview".equalsIgnoreCase(lclExportNotiFicationForm.getNoticeStatus())) {
            vessel = lclExportNotiFicationForm.getVessel() != null ? lclExportNotiFicationForm.getVessel() : "";
            portLrd = lclExportNotiFicationForm.getPortLrd() != null
                    && !"0".equalsIgnoreCase(lclExportNotiFicationForm.getPortLrd())
                            ? lclExportNotiFicationForm.getPortLrd()
                            : "";
            sail_date = lclExportNotiFicationForm.getSailDate() != null
                    ? DateUtils.formatDate(lclExportNotiFicationForm.getSailDate(), "MM/dd/yyyy")
                    : "";
            eta_date = lclExportNotiFicationForm.getEtaDate() != null
                    ? DateUtils.formatDate(lclExportNotiFicationForm.getEtaDate(), "MM/dd/yyyy")
                    : "";
            ss_line = lclExportNotiFicationForm.getSsLine() != null ? lclExportNotiFicationForm.getSsLine()
                    : "";
            ss_voyage = lclExportNotiFicationForm.getSsVoyage() != null
                    ? lclExportNotiFicationForm.getSsVoyage()
                    : "";
            pier = lclExportNotiFicationForm.getPier() != null ? lclExportNotiFicationForm.getPier()
                    .substring(0, lclExportNotiFicationForm.getPier().indexOf("(")) : "";
            pier = pier.replace("/", ", ");
        } else {
            vessel = CommonUtils.isNotEmpty(lclSsDetail.getSpReferenceName()) ? lclSsDetail.getSpReferenceName()
                    : "";
            portLrd = CommonUtils.isNotEmpty(lclSsDetail.getRelayLrdOverride())
                    ? lclSsDetail.getRelayLrdOverride().toString()
                    : "";
            sail_date = lclSsDetail.getStd() != null ? DateUtils.formatDate(lclSsDetail.getStd(), "MM/dd/yyyy")
                    : "";
            eta_date = lclSsDetail.getSta() != null ? DateUtils.formatDate(lclSsDetail.getSta(), "MM/dd/yyyy")
                    : "";
            ss_line = lclSsDetail.getSpAcctNo() != null ? lclSsDetail.getSpAcctNo().getAccountName() : "";
            ss_voyage = lclSsDetail.getSpReferenceNo() != null ? lclSsDetail.getSpReferenceNo() : "";
            pier = CommonUtils.isNotEmpty(lclExportNotiFicationForm.getPier()) ? lclExportNotiFicationForm
                    .getPier().substring(0, lclExportNotiFicationForm.getPier().indexOf("(")) : "";
            pier = lclSsDetail.getDeparture().getUnLocationName() + "," + stateValue;
        }

        table.addCell(allocateCell("Voy#...:" + lclSsDetail.getLclSsHeader().getScheduleNo(), true));
        table.addCell(allocateCell("Voy#...:" + lclSsDetail.getLclSsHeader().getScheduleNo(), false));

        table.addCell(allocateCell("Vessel Name..:" + vessel, true));
        table.addCell(allocateCell("Vessel Name..:" + lclSsDetail.getSpReferenceName(), false));

        table.addCell(allocateCell("Pier.........:" + pier, true));
        String changedCity = lclSsDetail.getDeparture().getUnLocationName() + ", " + stateValue;
        table.addCell(allocateCell("Pier.........:" + changedCity, false));
        String lrdOverride = null != lclSsDetail.getRelayLrdOverride()
                ? lclSsDetail.getRelayLrdOverride().toString()
                : "";
        table.addCell(allocateCell("Port LRD ....:" + portLrd, true));
        table.addCell(allocateCell("Port LRD ....:" + lrdOverride, false));

        table.addCell(allocateCell("Sail Date....:" + sail_date, true));
        table.addCell(allocateCell("Sail Date....:" + DateUtils.formatDate(lclSsDetail.getStd(), "MM/dd/yyyy"),
                false));

        table.addCell(allocateCell("ETA POD Date :" + eta_date, true));
        table.addCell(allocateCell("ETA POD Date :" + DateUtils.formatDate(lclSsDetail.getSta(), "MM/dd/yyyy"),
                false));
        ETA_FD = lclSsDetail.getSta();
        table.addCell(allocateCell("Line Name....:" + ss_line, true));
        table.addCell(allocateCell("Line Name....:" + lclSsDetail.getSpAcctNo().getAccountName(), false));

        table.addCell(allocateCell("SS Voyage#...:" + ss_voyage, true));
        table.addCell(allocateCell("SS Voyage#...:" + lclSsDetail.getSpReferenceNo(), false));

        table.addCell(allocateCell(" ", true));
        table.addCell(allocateCell(" ", false));
    }
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    cell.setBorderWidthTop(0.6f);
    table.addCell(cell);

    return table;
}

From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java

public PdfPTable reasonBlock(LclExportNotiFicationForm lclExportNotiFicationForm)
        throws IOException, BadElementException, DocumentException, Exception {
    User user = new UserDAO().findById(
            lclExportNotiFicationForm.getUserId() != null ? lclExportNotiFicationForm.getUserId().intValue()
                    : 0);/*  w  ww .j a va2 s .c om*/
    String userName = user != null ? user.getFirstName() : "";
    table = new PdfPTable(2);
    table.setWidthPercentage(100f);
    Font fontArialBold = FontFactory.getFont("Courier", 10f, Font.BOLD);
    Font fontArialNormal = FontFactory.getFont("Courier", 10f, Font.NORMAL);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    p = new Paragraph(9f, "Reason:", fontArialBold);
    cell.addElement(p);
    table.addCell(cell);
    String voyageChangeReason = CommonUtils.isNotEmpty(lclExportNotiFicationForm.getVoyageReason())
            ? lclExportNotiFicationForm.getVoyageReason().toUpperCase()
            : "";
    String voyageComment = CommonUtils.isNotEmpty(lclExportNotiFicationForm.getVoyageComment())
            ? lclExportNotiFicationForm.getVoyageComment().toUpperCase()
            : "";
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    p = new Paragraph(9f, "" + voyageChangeReason + "\n" + voyageComment, fontArialNormal);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    p = new Paragraph(20f, "Changes Made By:" + userName, fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    p = new Paragraph(20f, "Contact#", fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    p = new Paragraph(7f, null != user ? user.getTelephone() : "", fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    String notes = "";
    if ("preview".equalsIgnoreCase(lclExportNotiFicationForm.getNoticeStatus())) {
        notes = lclExportNotiFicationForm.getRemarks() != null
                ? lclExportNotiFicationForm.getRemarks().toUpperCase()
                : "";
    }
    p = new Paragraph(7f, "Notes:", fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    p = new Paragraph(7f, " " + notes, fontArialNormal);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(2);
    p = new Paragraph(10f, " ", fontArialNormal);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(1);
    cell.setColspan(2);
    table.addCell(cell);
    return table;
}

From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java

public PdfPTable footerBlock() throws IOException, BadElementException, DocumentException, Exception {
    table = new PdfPTable(3);
    table.setWidthPercentage(100f);/*from  w w w  . j  a v  a  2  s.  com*/
    Font fontArialNormal = FontFactory.getFont("Courier", 10f, Font.NORMAL);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    p = new Paragraph(9f, "Date:" + DateUtils.formatDate(new Date(), "MM/dd/yyyy"), fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);

    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    p = new Paragraph(9f, "End Of Report", fontArialNormal);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    p = new Paragraph(9f, "Time :" + new Date().getHours() + ":" + new Date().getMinutes(), fontArialNormal);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);
    table.addCell(cell);
    return table;
}