Example usage for com.itextpdf.text FontFactory getFont

List of usage examples for com.itextpdf.text FontFactory getFont

Introduction

In this page you can find the example usage for com.itextpdf.text FontFactory getFont.

Prototype


public static Font getFont(final String fontname, final float size, final int style) 

Source Link

Document

Constructs a Font-object.

Usage

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  . ja  va2 s  . 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.lcl.report.LclVoyageNotificationPdfCreator.java

public PdfPTable onStartPage(String realPath, String scheduleNo, String unitNo, String voyContent)
        throws Exception {
    String path = LoadLogisoftProperties.getProperty("application.image.logo");
    Font fontArialBold = FontFactory.getFont("Arial", 10f, Font.BOLD);
    Font colorBoldFont = FontFactory.getFont("Arial", 12f, Font.BOLD, new BaseColor(00, 102, 00));
    Phrase p = null;//from   w w  w .java  2s  . c  o m
    Paragraph pValues = null;
    table = new PdfPTable(6);
    table.setWidths(new float[] { 0.1f, 1.8f, 2.5f, 3.5f, 1.8f, 1.8f });
    table.setWidthPercentage(100f);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setRowspan(3);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setPadding(0f);
    cell.setBorder(0);
    cell.setPaddingBottom(3f);
    p = new Phrase("", fontArialBold);
    p.setLeading(20f);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setPaddingBottom(3f);
    pValues = new Paragraph(25f, "", fontArialBold);
    cell.addElement(pValues);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setRowspan(3);
    cell.setBorder(0);
    cell.setPadding(0f);
    Image img = Image.getInstance(realPath + path);
    img.scalePercent(60);
    img.setAlignment(Element.ALIGN_CENTER);
    img.setAlignment(Element.ALIGN_TOP);
    cell.addElement(img);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setPaddingBottom(3f);
    pValues = new Paragraph(20f, "Date:", fontArialBold);
    pValues.setAlignment(Element.ALIGN_RIGHT);
    cell.addElement(pValues);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setPaddingBottom(3f);
    pValues = new Paragraph(20f, " " + DateUtils.formatStringDateToAppFormatMMM(new Date()), fontArialBold);
    pValues.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(pValues);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(0f);
    cell.setBorder(0);
    cell.setPaddingBottom(3f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPaddingBottom(3f);
    cell.setPadding(0f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setPaddingBottom(3f);
    pValues = new Paragraph(9f, "Time:", fontArialBold);
    pValues.setAlignment(Element.ALIGN_RIGHT);
    cell.addElement(pValues);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setPaddingBottom(3f);
    pValues = new Paragraph(9f, " " + DateUtils.formatStringDateToTimeTT(new Date()), fontArialBold);
    pValues.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(pValues);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorder(0);
    cell.setPadding(0f);
    cell.setPaddingBottom(3f);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorder(0);
    cell.setPaddingBottom(3f);
    table.addCell(cell);
    //voyage
    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(3);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setPaddingLeft(5f);
    pValues = new Paragraph(8f, "VOYAGE NOTIFICATION", colorBoldFont);
    pValues.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(pValues);
    table.addCell(cell);

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

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

public PdfPTable voyInfo(LclUnitSs lclUnitSs) throws DocumentException {
    StringBuilder originValues = new StringBuilder();
    if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationName())) {
        originValues.append(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationName()).append(",");
    }//  w  w  w  . ja v  a  2  s. c o m
    if (null != lclUnitSs.getLclSsHeader().getOrigin().getCountryId()
            && CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getOrigin().getCountryId().getCodedesc())) {
        originValues.append(lclUnitSs.getLclSsHeader().getOrigin().getCountryId().getCodedesc()).append("  ");
    }
    if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationCode())) {
        originValues.append("(").append(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationCode()).append(")");
    }

    StringBuilder fdValues = new StringBuilder();
    if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getDestination().getUnLocationName())) {
        fdValues.append(lclUnitSs.getLclSsHeader().getDestination().getUnLocationName()).append(",");
    }
    if (null != lclUnitSs.getLclSsHeader().getDestination().getStateId()
            && CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getDestination().getStateId().getCode())) {
        fdValues.append(lclUnitSs.getLclSsHeader().getDestination().getStateId().getCode()).append(" ");
    }
    if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getDestination().getUnLocationCode())) {
        fdValues.append("(").append(lclUnitSs.getLclSsHeader().getDestination().getUnLocationCode())
                .append(")");
    }
    Font fontCompSub = FontFactory.getFont("Arial", 9f, Font.BOLD);
    Paragraph pHeading = null;
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);
    PdfPCell cell1 = new PdfPCell();
    cell1.setBorder(0);
    cell1.setColspan(2);
    cell1.setBorderColor(new BaseColor(00, 51, 153));
    cell1.setBorderWidthBottom(3f);
    cell1.setBorderWidthLeft(3f);
    cell1.setBorderWidthRight(3f);
    cell1.setBorderWidthTop(10f);
    cell1.setPadding(0f);
    //Heading
    pHeading = new Paragraph(8f, "Voyage Information", mainHeadingQuote);
    pHeading.setAlignment(Element.ALIGN_CENTER);
    cell1.addElement(pHeading);
    PdfPTable ntable1 = new PdfPTable(6);
    ntable1.setWidthPercentage(100f);
    ntable1.setWidths(new float[] { 0.1f, 1.15f, 0.09f, 4.09f, 1f, 2f });
    //company Name
    ntable1.addCell(createEmptyCell(0, 1f, 6));
    //Voyage Cell Origin
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("Voyage. . . . . . . . . .", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(lclUnitSs.getLclSsHeader().getScheduleNo().toUpperCase(), 4, 0f, 5f,
            fontgreenCont));
    //1Cell Origin
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("Origin. . . . . . . . . . .", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(originValues.toString().toUpperCase(), 4, 0f, 5f, fontgreenCont));
    ///2Cell Destination
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("Destination. . . . . .", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(fdValues.toString().toUpperCase(), 4, 0f, 5f, fontgreenCont));
    //3
    StringBuilder billValues = new StringBuilder();
    if (lclUnitSs.getLclSsHeader().getBillingTerminal().getTrmnum() != null) {
        billValues.append(lclUnitSs.getLclSsHeader().getBillingTerminal().getTrmnum()).append("-");
    }
    if (lclUnitSs.getLclSsHeader().getBillingTerminal().getTerminalLocation() != null) {
        billValues.append(lclUnitSs.getLclSsHeader().getBillingTerminal().getTerminalLocation());
    }
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("Billing Terminal. . ", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(billValues.toString().toUpperCase(), 4, 0f, 4f, fontgreenCont));

    ntable1.addCell(createEmptyCell(0, 1f, 6));
    cell1.addElement(ntable1);
    table.addCell(cell1);
    return table;
}

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

public PdfPTable unitInfo(LclUnitSs lclUnitSs) throws DocumentException, Exception {
    LclUnitSsImports lclUnitSsImports = lclUnitSs.getLclUnit().getLclUnitSsImportsList().get(0);
    StringBuilder cfsWarehs = new StringBuilder();
    if (lclUnitSsImports != null && lclUnitSsImports.getCfsWarehouseId() != null) {
        if (lclUnitSsImports.getCfsWarehouseId().getWarehouseName() != null) {
            cfsWarehs.append(lclUnitSsImports.getCfsWarehouseId().getWarehouseName()).append("-");
        }/*from  w w w . j  a v a2  s  .co  m*/
        if (lclUnitSsImports.getCfsWarehouseId().getWarehouseNo() != null) {
            cfsWarehs.append(lclUnitSsImports.getCfsWarehouseId().getWarehouseNo());
        }
    }
    LclUnitSsManifest lclUnitSsManifest = lclUnitSs.getLclUnit().getLclUnitSsManifestList().get(0);
    Font fontCompSub = FontFactory.getFont("Arial", 9f, Font.BOLD);
    Paragraph pHeading = null;
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);
    PdfPCell cell1 = new PdfPCell();
    cell1.setBorder(0);
    cell1.setColspan(2);
    cell1.setBorderColor(new BaseColor(00, 51, 153));
    cell1.setBorderWidthBottom(3f);
    cell1.setBorderWidthLeft(3f);
    cell1.setBorderWidthRight(3f);
    cell1.setBorderWidthTop(10f);
    cell1.setPadding(0f);
    //Heading
    pHeading = new Paragraph(8f, "Unit Information", mainHeadingQuote);
    pHeading.setAlignment(Element.ALIGN_CENTER);
    cell1.addElement(pHeading);
    PdfPTable ntable1 = new PdfPTable(6);
    ntable1.setWidthPercentage(100f);
    ntable1.setWidths(new float[] { 0.1f, 1.15f, 0.09f, 4.09f, 1f, 2f });
    //company Name
    ntable1.addCell(createEmptyCell(0, 1f, 6));
    //unit No Cell
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("Unit No . . . . . . . . .", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(
            makeCellNoBorderValue(lclUnitSs.getLclUnit().getUnitNo().toUpperCase(), 4, 0f, 4f, fontgreenCont));
    //3
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("CFS(Devanning). . ", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(cfsWarehs.toString().toUpperCase(), 4, 0f, 4f, fontgreenCont));
    //
    ntable1.addCell(createEmptyCell(0, 1f, 0));
    ntable1.addCell(makeCellNoBorderValue("Master BL. . . . . . . ", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub));
    ntable1.addCell(
            makeCellNoBorderValue(lclUnitSsManifest.getMasterbl().toUpperCase(), 4, 0f, 4f, fontgreenCont));

    ntable1.addCell(createEmptyCell(0, 1f, 6));
    cell1.addElement(ntable1);
    table.addCell(cell1);
    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 www.j  a  v  a2s.c  om*/
    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 headerPage(String voyageHeading) throws DocumentException {
    table = new PdfPTable(1);
    table.setWidths(new float[] { 6.9f });
    table.setWidthPercentage(100f);//from w w  w. ja v  a  2 s  . com
    Font fontArialBold = FontFactory.getFont("Courier", 25f, Font.BOLD);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(32f, "" + voyageHeading, fontArialBold);
    p.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(1);
    p = new Paragraph(25f, " ", 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 PdfPTable informationBlock(String companyName, String portofDischarge, String finalDestination)
        throws IOException, BadElementException, DocumentException {
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);/*from  w w w . java 2  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 av a  2  s . c  o m
    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 w w  .  j  av a2 s . c om
    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 containerBlock(String companyName, String portofDischarge, LclFileNumber fileNumber,
        LclExportNotiFicationForm lclExportNotiFicationForm)
        throws IOException, BadElementException, DocumentException, Exception {
    table = new PdfPTable(2);
    table.setWidths(new float[] { 5f, 5f });
    table.setWidthPercentage(100f);//from   w  w  w  .  j av a  2s .  c  o  m
    Font fontArialBold = FontFactory.getFont("Courier", 10f, Font.BOLD);
    Font bigArialBold = FontFactory.getFont("Courier", 15f, Font.BOLD);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(9f, "Container# ", fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);
    cell = new PdfPCell();
    cell.setBorder(0);
    p = new Paragraph(9f, "ETA-FINAL DESTINATION", bigArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    String containerNo = new LclExportsVoyageNotificationDAO()
            .getAllContainerNoFormVoyage(lclExportNotiFicationForm.getHeaderId().toString());
    p = new Paragraph(9f, "" + containerNo.replace(",", "\n"), fontArialBold);
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(0);
    boolean isDrPicked = new ExportUnitQueryUtils().isPickedFile(fileNumber.getId());
    if (isDrPicked) {
        p = new Paragraph(9f, DateUtils.formatDate(ETA_FD, "MM/dd/yyyy") + " " + portofDischarge,
                fontArialBold);
    } else {
        String eta_date = DateUtils.formatDate(fileNumber.getLclBooking().getFdEta(), "MM/dd/yyyy");
        eta_date = eta_date != null ? eta_date : "";
        p = new Paragraph(9f, eta_date + " " + portofDischarge, fontArialBold);
    }
    p.setAlignment(Element.ALIGN_LEFT);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(4);
    p = new Paragraph(90f, " ", fontArialBold);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(2);
    cell.setColspan(4);
    table.addCell(cell);

    return table;
}