Example usage for com.itextpdf.text.pdf PdfPTable setSpacingAfter

List of usage examples for com.itextpdf.text.pdf PdfPTable setSpacingAfter

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPTable setSpacingAfter.

Prototype

public void setSpacingAfter(final float spacing) 

Source Link

Document

Sets the spacing after this table.

Usage

From source file:org.cidte.sii.negocio.PDFWriter.java

public void writePDF(ArrayList<Writable> list, String directorio, String nombre, java.awt.Image image)
        throws DocumentException, FileNotFoundException, BadElementException, IOException {

    Document doc = new Document();
    PdfWriter docWriter;//  w  ww . j a va 2s . c o  m

    // special font sizes
    Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD, new BaseColor(0, 0, 0));
    Font bf12 = new Font(Font.FontFamily.TIMES_ROMAN, 12);

    // file path
    String path = directorio + nombre + ".pdf";
    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(new File(path)));

    // document header attributes
    doc.addAuthor("sii");
    doc.addCreationDate();
    doc.addProducer();
    doc.addCreator("sii");
    doc.addTitle(nombre);
    doc.setPageSize(PageSize.LETTER);

    // open document
    doc.open();

    Image img = Image.getInstance(image, null);
    img.setAlignment(Element.ALIGN_LEFT);
    doc.add(img);

    // create a paragraph
    Paragraph paragraph = new Paragraph("iText  is a library that allows you to create and "
            + "manipulate PDF documents. It enables developers looking to enhance web and other "
            + "applications with dynamic PDF document generation and/or manipulation.");

    // create PDF table with the given widths
    PdfPTable table = new PdfPTable(list.get(0).getNames().length);
    // set table width a percentage of the page width
    table.setWidthPercentage(100);
    table.setSpacingBefore(10f); // Space before table
    table.setSpacingAfter(10f); // Space after table

    // insert column headings
    String[] headings = list.get(0).getNames();
    for (String heading : headings) {
        insertCell(table, heading, Element.ALIGN_CENTER, 1, bfBold12);
    }
    table.setHeaderRows(1);

    // insert the data
    for (int i = 0; i < list.size(); i++) {
        Writable w = list.get(i);
        Object[] arr = w.getAsArray();
        for (int j = 0; j < arr.length; j++) {
            // arr[j]
            insertCell(table, arr[j].toString(), Element.ALIGN_LEFT, 1, bf12);
        }
    }

    // insert an empty row
    // insertCell(table, "", Element.ALIGN_LEFT, 4, bfBold12);
    // add the PDF table to the paragraph
    paragraph.add(table);
    // add the paragraph to the document
    doc.add(paragraph);

    // close the document
    doc.close();

    // close the writer
    docWriter.close();

}

From source file:org.dspace.disseminate.CitationDocument.java

/**
 * Takes a DSpace {@link Bitstream} and uses its associated METADATA to
 * create a cover page./*from   www. j  av a 2 s .  c om*/
 *
 * @param cDoc The cover page document to add cited information to.
 * @param writer
 * @param cMeta
 *            METADATA retrieved from the parent collection.
 * @throws IOException
 * @throws DocumentException
 */
private void generateCoverPage(Document cDoc, PdfWriter writer, CitationMeta cMeta) throws DocumentException {
    cDoc.open();
    writer.setCompressionLevel(0);

    Item item = cMeta.getItem();

    //Set up some fonts
    Font helv26 = FontFactory.getFont(FontFactory.HELVETICA, 26f, BaseColor.BLACK);
    Font helv16 = FontFactory.getFont(FontFactory.HELVETICA, 16f, BaseColor.BLACK);
    Font helv12 = FontFactory.getFont(FontFactory.HELVETICA, 12f, BaseColor.BLACK);
    Font helv12_italic = FontFactory.getFont(FontFactory.HELVETICA_OBLIQUE, 12f, BaseColor.BLACK);
    Font helv11_bold = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 11f, BaseColor.BLACK);
    Font helv9 = FontFactory.getFont(FontFactory.HELVETICA, 9f, BaseColor.BLACK);

    // 1 - Header:
    //  University Name
    //  Repository Name                                                        repository.url
    Paragraph university = new Paragraph("The Ohio State University", helv11_bold);
    cDoc.add(university);

    PdfPTable repositoryTable = new PdfPTable(2);
    repositoryTable.setWidthPercentage(100);

    Chunk repositoryName = new Chunk("Knowledge Bank", helv11_bold);
    PdfPCell nameCell = new PdfPCell();
    nameCell.setBorderWidth(0);
    nameCell.addElement(repositoryName);

    Chunk repositoryURL = new Chunk("kb.osu.edu", helv11_bold);
    repositoryURL.setAnchor("http://kb.osu.edu");

    PdfPCell urlCell = new PdfPCell();
    urlCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    urlCell.setBorderWidth(0);
    urlCell.addElement(repositoryURL);

    repositoryTable.addCell(nameCell);
    repositoryTable.addCell(urlCell);

    repositoryTable.setSpacingAfter(5);

    cDoc.add(repositoryTable);

    // Line Separator
    LineSeparator lineSeparator = new LineSeparator();
    cDoc.add(lineSeparator);

    // 2 - Bread Crumbs
    // Community Name                                                          Collection Name
    PdfPTable breadcrumbTable = new PdfPTable(2);
    breadcrumbTable.setWidthPercentage(100);

    Chunk communityName = new Chunk(getOwningCommunity(item), helv9);
    PdfPCell commCell = new PdfPCell();
    commCell.setBorderWidth(0);
    commCell.addElement(communityName);

    Chunk collectionName = new Chunk(getOwningCollection(item), helv9);
    PdfPCell collCell = new PdfPCell();
    collCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    collCell.setBorderWidth(0);
    collCell.addElement(collectionName);

    breadcrumbTable.addCell(commCell);
    breadcrumbTable.addCell(collCell);

    breadcrumbTable.setSpacingBefore(5);
    breadcrumbTable.setSpacingAfter(5);

    cDoc.add(breadcrumbTable);

    // Line Separator
    cDoc.add(lineSeparator);

    // 3 - Metadata
    // date.issued
    // dc.title
    // dc.creator; dc.creator
    Paragraph dateIssued = new Paragraph(getFirstMetadata(item, "dc.date.issued"), helv12);
    dateIssued.setSpacingBefore(20);
    cDoc.add(dateIssued);

    Paragraph title = new Paragraph(item.getName(), helv26);
    title.setSpacingBefore(15);
    cDoc.add(title);

    Paragraph creators = new Paragraph(getAllMetadataSeperated(item, "dc.creator"), helv16);
    creators.setSpacingBefore(30);
    creators.setSpacingAfter(20);
    cDoc.add(creators);

    // Line Separator
    cDoc.add(lineSeparator);

    // 4 - Citation
    // dc.identifier.citation
    // dc.identifier.uri
    Paragraph citation = new Paragraph(getFirstMetadata(item, "dc.identifier.citation"), helv12);

    Chunk identifierChunk = new Chunk(getFirstMetadata(item, "dc.identifier.uri"), helv12);
    identifierChunk.setAnchor(getFirstMetadata(item, "dc.identifier.uri"));

    Paragraph identifier = new Paragraph();
    identifier.add(identifierChunk);

    cDoc.add(citation);
    cDoc.add(identifier);

    // 5 - License
    // Downloaded from the Knowledge Bank, The Ohio State University's institutional repository
    Paragraph license = new Paragraph(
            "Downloaded from the Knowledge Bank, The Ohio State University's institutional repository",
            helv12_italic);
    license.setSpacingBefore(10);
    cDoc.add(license);

    cDoc.close();
}

From source file:org.inspira.condominio.pdf.DocumentoEgresos.java

public void exportarPdf(String destino) throws IOException, DocumentException {
    File file = new File(destino);
    file.getParentFile().mkdirs();//from  www.j a va  2  s . c  o m
    PdfWriter.getInstance(documento, new FileOutputStream(file));
    documento.open();
    documento.add(new Paragraph(
            "Periodo: ".concat(
                    DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(new Date())),
            F_NORMAL));
    documento.add(new Paragraph(admin, F_NORMAL));
    Paragraph heading = new Paragraph("Gastos ".concat(tipoDeGasto),
            new Font(Font.FontFamily.HELVETICA, 18, Font.BOLD, new BaseColor(0x000000)));
    heading.setSpacingBefore(16f);
    heading.setSpacingAfter(16f);
    Paragraph heading2 = new Paragraph("Autoriz",
            new Font(Font.FontFamily.HELVETICA, 12, Font.NORMAL, new BaseColor(0x000000)));
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100);
    Paragraph heading3 = new Paragraph("Vo. Bo.",
            new Font(Font.FontFamily.HELVETICA, 12, Font.NORMAL, new BaseColor(0x000000)));
    PdfPCell cell1 = new PdfPCell(heading2);
    cell1.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell1.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell1.setColspan(1);
    cell1.setFixedHeight(20f);
    cell1.setBorder(Rectangle.NO_BORDER);
    PdfPCell cell2 = new PdfPCell(heading3);
    cell2.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell2.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell2.setColspan(1);
    cell2.setFixedHeight(20f);
    cell2.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell1);
    table.addCell(cell2);
    table.setSpacingBefore(16f);
    table.setSpacingAfter(32f);

    documento.add(heading);
    agregarTablaEgresos(egresos);
    documento.add(table);
    agregarZonaVistoBueno();
    documento.close();
}

From source file:org.inspira.condominio.pdf.DocumentoEstadoDeCuenta.java

private void agregaTablaDeAdeudos() throws DocumentException {
    PdfPTable t1 = new PdfPTable(9);
    float total = setTableHeading(t1, adeudos);
    PdfPCell cInteresMoratorioLegal = new PdfPCell(new Phrase("Inters moratorio legal"));
    cInteresMoratorioLegal.setColspan(3);
    t1.addCell(cInteresMoratorioLegal);/*from w w w  .j a  v a2  s  .co  m*/
    PdfPCell cFechaIML = new PdfPCell(new Paragraph("---"));
    cFechaIML.setColspan(3);
    cFechaIML.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    t1.addCell(cFechaIML);
    PdfPCell cMontoIML = new PdfPCell(
            new Paragraph(String.format("%.2f pesos", total * INTERES_MORATORIO_LEGAL)));
    cMontoIML.setColspan(3);
    cMontoIML.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cMontoIML.setVerticalAlignment(PdfPCell.ALIGN_CENTER);
    t1.addCell(cMontoIML);
    PdfPCell cSancionesEstablecidasPorAsamblea = new PdfPCell(
            new Paragraph("Sanciones establecidas por asamblea"));
    cSancionesEstablecidasPorAsamblea.setColspan(3);
    t1.addCell(cSancionesEstablecidasPorAsamblea);
    PdfPCell cFechaSEA = new PdfPCell(new Paragraph("---"));
    cFechaSEA.setColspan(3);
    cFechaSEA.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cFechaSEA.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cFechaSEA.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    t1.addCell(cFechaSEA);
    PdfPCell cMontoSEA = new PdfPCell(new Paragraph(String.format("%.2f pesos", total * porcentajeSanciones)));
    cMontoSEA.setColspan(3);
    cMontoSEA.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cMontoSEA.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    t1.addCell(cMontoSEA);
    total *= INTERES_MORATORIO_LEGAL + porcentajeSanciones;
    PdfPCell cTotal = new PdfPCell(new Phrase("Total", F_NORMAL));
    cTotal.setColspan(6);
    cTotal.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
    t1.addCell(cTotal);
    PdfPCell cMontoTotal = new PdfPCell(new Phrase(String.format("%.2f pesos", total), F_NORMAL));
    cMontoTotal.setColspan(3);
    cMontoTotal.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    t1.addCell(cMontoTotal);
    t1.setSpacingBefore(20f);
    t1.setSpacingAfter(12f);
    documento.add(t1);
}

From source file:org.openlmis.web.view.pdf.requisition.RequisitionPdfModel.java

License:Open Source License

public PdfPTable getRequisitionHeader() throws DocumentException {
    PdfPTable table = prepareRequisitionHeaderTable();
    addHeading(table);//ww w. j  av  a2 s .co m

    Facility facility = requisition.getFacility();
    addFirstLine(facility, table);
    addSecondLine(facility, table, requisition.isEmergency());
    table.setSpacingAfter(PARAGRAPH_SPACING);
    return table;
}

From source file:org.totschnig.myexpenses.model.Account.java

License:Open Source License

private void addTransactionList(Document document, Cursor transactionCursor, PdfHelper helper,
        WhereFilter filter) throws DocumentException, IOException {
    String selection;/* ww  w .j a v  a 2s  .co m*/
    String[] selectionArgs;
    if (!filter.isEmpty()) {
        selection = filter.getSelectionForParts(DatabaseConstants.VIEW_EXTENDED);//GROUP query uses extended view
        selectionArgs = filter.getSelectionArgs(true);
    } else {
        selection = null;
        selectionArgs = null;
    }
    Builder builder = Transaction.CONTENT_URI.buildUpon();
    builder.appendPath(TransactionProvider.URI_SEGMENT_GROUPS).appendPath(grouping.name());
    if (getId() < 0) {
        builder.appendQueryParameter(KEY_CURRENCY, currency.getCurrencyCode());
    } else {
        builder.appendQueryParameter(KEY_ACCOUNTID, String.valueOf(getId()));
    }
    Cursor groupCursor = cr().query(builder.build(), null, selection, selectionArgs,
            KEY_YEAR + " ASC," + KEY_SECOND_GROUP + " ASC");

    MyApplication ctx = MyApplication.getInstance();

    int columnIndexGroupSumIncome = groupCursor.getColumnIndex(KEY_SUM_INCOME);
    int columnIndexGroupSumExpense = groupCursor.getColumnIndex(KEY_SUM_EXPENSES);
    int columnIndexGroupSumTransfer = groupCursor.getColumnIndex(KEY_SUM_TRANSFERS);
    int columIndexGroupSumInterim = groupCursor.getColumnIndex(KEY_INTERIM_BALANCE);
    int columnIndexRowId = transactionCursor.getColumnIndex(KEY_ROWID);
    int columnIndexYear = transactionCursor.getColumnIndex(KEY_YEAR);
    int columnIndexYearOfWeekStart = transactionCursor.getColumnIndex(KEY_YEAR_OF_WEEK_START);
    int columnIndexMonth = transactionCursor.getColumnIndex(KEY_MONTH);
    int columnIndexWeek = transactionCursor.getColumnIndex(KEY_WEEK);
    int columnIndexDay = transactionCursor.getColumnIndex(KEY_DAY);
    int columnIndexAmount = transactionCursor.getColumnIndex(KEY_AMOUNT);
    int columnIndexLabelSub = transactionCursor.getColumnIndex(KEY_LABEL_SUB);
    int columnIndexLabelMain = transactionCursor.getColumnIndex(KEY_LABEL_MAIN);
    int columnIndexComment = transactionCursor.getColumnIndex(KEY_COMMENT);
    int columnIndexReferenceNumber = transactionCursor.getColumnIndex(KEY_REFERENCE_NUMBER);
    int columnIndexPayee = transactionCursor.getColumnIndex(KEY_PAYEE_NAME);
    int columnIndexTransferPeer = transactionCursor.getColumnIndex(KEY_TRANSFER_PEER);
    int columnIndexDate = transactionCursor.getColumnIndex(KEY_DATE);
    DateFormat itemDateFormat;
    switch (grouping) {
    case DAY:
        itemDateFormat = android.text.format.DateFormat.getTimeFormat(ctx);
        break;
    case MONTH:
        itemDateFormat = new SimpleDateFormat("dd");
        break;
    case WEEK:
        itemDateFormat = new SimpleDateFormat("EEE");
        break;
    default:
        itemDateFormat = Utils.localizedYearlessDateFormat();
    }
    PdfPTable table = null;

    int prevHeaderId = 0, currentHeaderId;

    transactionCursor.moveToFirst();
    groupCursor.moveToFirst();

    while (transactionCursor.getPosition() < transactionCursor.getCount()) {
        int year = transactionCursor
                .getInt(grouping.equals(Grouping.WEEK) ? columnIndexYearOfWeekStart : columnIndexYear);
        int month = transactionCursor.getInt(columnIndexMonth);
        int week = transactionCursor.getInt(columnIndexWeek);
        int day = transactionCursor.getInt(columnIndexDay);
        int second = -1;

        switch (grouping) {
        case DAY:
            currentHeaderId = year * 1000 + day;
            break;
        case WEEK:
            currentHeaderId = year * 1000 + week;
            break;
        case MONTH:
            currentHeaderId = year * 1000 + month;
            break;
        case YEAR:
            currentHeaderId = year * 1000;
            break;
        default:
            currentHeaderId = 1;
        }
        if (currentHeaderId != prevHeaderId) {
            if (table != null) {
                document.add(table);
            }
            switch (grouping) {
            case DAY:
                second = transactionCursor.getInt(columnIndexDay);
                break;
            case MONTH:
                second = transactionCursor.getInt(columnIndexMonth);
                break;
            case WEEK:
                second = transactionCursor.getInt(columnIndexWeek);
                break;
            }
            table = helper.newTable(2);
            table.setWidthPercentage(100f);
            PdfPCell cell = helper.printToCell(grouping.getDisplayTitle(ctx, year, second, transactionCursor),
                    FontType.HEADER);
            table.addCell(cell);
            Long sumExpense = DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumExpense);
            Long sumIncome = DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumIncome);
            Long sumTransfer = DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumTransfer);
            Long delta = sumIncome - sumExpense + sumTransfer;
            Long interimBalance = DbUtils.getLongOr0L(groupCursor, columIndexGroupSumInterim);
            Long previousBalance = interimBalance - delta;
            cell = helper.printToCell(String.format("%s %s %s = %s",
                    Utils.convAmount(previousBalance, currency), Long.signum(delta) > -1 ? "+" : "-",
                    Utils.convAmount(Math.abs(delta), currency), Utils.convAmount(interimBalance, currency)),
                    FontType.HEADER);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(cell);
            document.add(table);
            table = helper.newTable(3);
            table.setWidthPercentage(100f);
            cell = helper.printToCell("+ " + Utils.convAmount(sumIncome, currency), FontType.NORMAL);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell);
            cell = helper.printToCell("- " + Utils.convAmount(sumExpense, currency), FontType.NORMAL);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell);
            cell = helper.printToCell("<-> "
                    + Utils.convAmount(DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumTransfer), currency),
                    FontType.NORMAL);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell);
            table.setSpacingAfter(2f);
            document.add(table);
            LineSeparator sep = new LineSeparator();
            document.add(sep);
            table = helper.newTable(4);
            table.setWidths(new int[] { 1, 5, 3, 2 });
            table.setSpacingBefore(2f);
            table.setSpacingAfter(2f);
            table.setWidthPercentage(100f);
            prevHeaderId = currentHeaderId;
            groupCursor.moveToNext();
        }
        long amount = transactionCursor.getLong(columnIndexAmount);
        String catText = transactionCursor.getString(columnIndexLabelMain);

        PdfPCell cell = helper.printToCell(
                Utils.convDateTime(transactionCursor.getString(columnIndexDate), itemDateFormat),
                FontType.NORMAL);
        table.addCell(cell);
        if (DbUtils.getLongOrNull(transactionCursor, columnIndexTransferPeer) != null) {
            catText = ((amount < 0) ? "=> " : "<= ") + catText;
        } else {
            Long catId = DbUtils.getLongOrNull(transactionCursor, KEY_CATID);
            if (SPLIT_CATID.equals(catId)) {
                Cursor splits = cr().query(Transaction.CONTENT_URI, null,
                        KEY_PARENTID + " = " + transactionCursor.getLong(columnIndexRowId), null, null);
                splits.moveToFirst();
                catText = "";
                while (splits.getPosition() < splits.getCount()) {
                    String splitText = DbUtils.getString(splits, KEY_LABEL_MAIN);
                    if (splitText.length() > 0) {
                        if (DbUtils.getLongOrNull(splits, KEY_TRANSFER_PEER) != null) {
                            splitText = "[" + splitText + "]";
                        } else {
                            String label_sub = DbUtils.getString(splits, KEY_LABEL_SUB);
                            if (label_sub.length() > 0)
                                splitText += TransactionList.CATEGORY_SEPARATOR + label_sub;
                        }
                    } else {
                        splitText = ctx.getString(R.string.no_category_assigned);
                    }
                    splitText += " " + Utils
                            .convAmount(splits.getLong(splits.getColumnIndexOrThrow(KEY_AMOUNT)), currency);
                    String splitComment = DbUtils.getString(splits, KEY_COMMENT);
                    if (splitComment != null && splitComment.length() > 0) {
                        splitText += " (" + splitComment + ")";
                    }
                    catText += splitText;
                    if (splits.getPosition() != splits.getCount() - 1) {
                        catText += "; ";
                    }
                    splits.moveToNext();
                }
                splits.close();
            } else if (catId == null) {
                catText = ctx.getString(R.string.no_category_assigned);
            } else {
                String label_sub = transactionCursor.getString(columnIndexLabelSub);
                if (label_sub != null && label_sub.length() > 0) {
                    catText = catText + TransactionList.CATEGORY_SEPARATOR + label_sub;
                }
            }
        }
        String referenceNumber = transactionCursor.getString(columnIndexReferenceNumber);
        if (referenceNumber != null && referenceNumber.length() > 0)
            catText = "(" + referenceNumber + ") " + catText;
        cell = helper.printToCell(catText, FontType.NORMAL);
        String payee = transactionCursor.getString(columnIndexPayee);
        if (payee == null || payee.length() == 0) {
            cell.setColspan(2);
        }
        table.addCell(cell);
        if (payee != null && payee.length() > 0) {
            table.addCell(helper.printToCell(payee, FontType.UNDERLINE));
        }
        FontType t = amount < 0 ? FontType.EXPENSE : FontType.INCOME;
        cell = helper.printToCell(Utils.convAmount(amount, currency), t);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(cell);
        String comment = transactionCursor.getString(columnIndexComment);
        if (comment != null && comment.length() > 0) {
            cell = helper.printToCell(comment, FontType.ITALIC);
            cell.setColspan(2);
            table.addCell(helper.emptyCell());
            table.addCell(cell);
            table.addCell(helper.emptyCell());
        }
        transactionCursor.moveToNext();
    }
    // now add all this to the document
    document.add(table);
    groupCursor.close();
}

From source file:Output.QuotePDf.java

private PdfPTable sectionSeparator() {
    PdfPTable separator = new PdfPTable(1);
    separator.setWidthPercentage(100f);/*from   w ww  .  j  a  va2 s. c  om*/
    cell = new PdfPCell(new Phrase(" "));
    cell.setBorder(Rectangle.BOTTOM);
    separator.addCell(cell);
    separator.setSpacingAfter(10f);
    return separator;
}

From source file:Output.QuotePDf.java

private PdfPTable rateTable() throws DocumentException {
    PdfPTable table = new PdfPTable(2);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    float[] columnWidths = new float[] { 35f, 75f };
    table.setWidths(columnWidths);//  ww  w .ja  v a2 s  . c  o m
    table.setSpacingAfter(10f);

    cell = new PdfPCell(new Phrase("Base Ocean Freight:", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(oft, textFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("MAFI Minimum Charge:", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    if (includeMafiMinimum) {
        cell = new PdfPCell(new Phrase("$" + mafiMinimum + " per MAFI unit.", textFont));
        cell.setColspan(1);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
    } else {
        cell = new PdfPCell(new Phrase("N/A", textFont));
        cell.setColspan(1);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
    }
    cell = new PdfPCell(new Phrase("Subject To:", subjectToFont));
    cell.setColspan(2);
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Bunker Adjustment Factor:", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(baf, textFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("ECA Surcharge:", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(eca, textFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Terminal Handling (Origin):", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(thc, textFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Wharfage (Origin):", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(wfg, textFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Documentation Fee:", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(doc, textFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("War Risk Surcharge:", labelFont));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    if (includeWarRisk) {
        cell = new PdfPCell(new Phrase(wRsk, textFont));
        cell.setColspan(1);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
    } else {
        cell = new PdfPCell(new Phrase("N/A", textFont));
        cell.setColspan(1);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
    }

    return table;
}

From source file:Output.QuotePDf.java

private PdfPTable disclaimerTable(Boolean spotrate, String mtdApproval, String spaceApproval,
        String overseasResponse) throws DocumentException {
    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);//  w ww.ja v  a  2 s . co  m
    table.setSpacingAfter(10f);
    if (spotrate) {
        cell = new PdfPCell(new Phrase(
                "This rate requires special FMC filing. If you intend to book at this rate you must notify sales in writing prior to booking.",
                fmcFont));
        cell.setBackgroundColor(BaseColor.YELLOW);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
    }
    if (mtdApproval.equals("Pending") || spaceApproval.equals("Pending")
            || overseasResponse.equals("Pending")) {
        cell = new PdfPCell(new Phrase("Rate is subject to final operational acceptance.", fmcFont));
        cell.setBackgroundColor(BaseColor.YELLOW);
        cell.setBorder(Rectangle.NO_BORDER);
        table.addCell(cell);
    }
    cell = new PdfPCell(new Phrase(
            "Rates quoted are valid for 30 days from date of issue unless otherwise noted.", disclaimerFont));
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(
            new Phrase("Any extra charges for special handling are for the shipper's account and arrangement.",
                    disclaimerFont));
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(
            new Phrase("Static/towable accessories must move with the main unit for the same rate to apply.",
                    disclaimerFont));
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(
            "Please always include the group email kam-roro-sales@us.kline.com in any correspondence.",
            disclaimerFont));
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(
            "Please reference RQS number when booking with customer service (kamricbcarcus@us.kline.com).",
            disclaimerFont));
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    return table;
}

From source file:Output.QuotePDf.java

private PdfPTable carrierComments(Boolean includeCarrierComments, String carrierComments) {
    PdfPTable table = new PdfPTable(1);
    table.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.setWidthPercentage(100f);/*  w w w. j av a  2 s  .  com*/
    table.setSpacingAfter(10f);
    if (includeCarrierComments) {
        cell = new PdfPCell(new Phrase("Carrier Comments", tableHeadingFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setPaddingBottom(10f);
        cell.setBackgroundColor(BaseColor.BLACK);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(carrierComments, textFont));
        cell.setPadding(5f);
        table.addCell(cell);
    }
    return table;
}