Example usage for com.itextpdf.text.pdf PdfPCell setBorder

List of usage examples for com.itextpdf.text.pdf PdfPCell setBorder

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPCell setBorder.

Prototype

public void setBorder(final int border) 

Source Link

Document

Enables/Disables the border on the specified sides.

Usage

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterVersetzungsvermerkLine(String versetzungsvermerk, Font footerFont)
        throws DocumentException {
    PdfPCell labelCell = new PdfPCell(new Phrase("Versetzungsvermerk", footerFont));
    labelCell.setBorder(Rectangle.BOTTOM);
    labelCell.setBorderWidth(1f);//from   www.  j  av  a  2s .  c o m

    PdfPCell nameCell = new PdfPCell(new Phrase(versetzungsvermerk, footerFont));
    nameCell.setBorder(Rectangle.BOTTOM);
    nameCell.setBorderWidth(1f);

    PdfPTable table = new PdfPTable(2);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setWidthPercentage(100f);
    table.addCell(labelCell);
    table.addCell(nameCell);
    table.setWidths(new float[] { 0.3f, 0.7f });
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterDatumLine(String datumString, Font footerFont) throws DocumentException {
    PdfPCell labelCell = new PdfPCell(new Phrase("Datum", footerFont));
    labelCell.setBorder(Rectangle.BOTTOM);
    labelCell.setBorderWidth(1f);/* w  w  w.  j  av  a2  s.c  o  m*/

    PdfPCell nameCell = new PdfPCell(new Phrase(datumString, footerFont));
    nameCell.setBorder(Rectangle.BOTTOM);
    nameCell.setBorderWidth(1f);

    PdfPTable table = new PdfPTable(2);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setWidthPercentage(100f);
    table.addCell(labelCell);
    table.addCell(nameCell);
    table.setWidths(new float[] { 0.3f, 0.7f });
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterDienstsiegelLine(Font footerFont) throws DocumentException {
    PdfPCell leftCell = new PdfPCell(new Phrase("", footerFont));
    leftCell.setBorder(Rectangle.NO_BORDER);
    leftCell.setBorderWidth(1f);/* w w w  .  j  a  v a2  s  .  co  m*/

    PdfPCell centerCell = new PdfPCell(new Phrase("Dienstsiegel der Schule", footerFont));
    centerCell.setBorder(Rectangle.NO_BORDER);
    centerCell.setBorderWidth(1f);
    centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell rightCell = new PdfPCell(new Phrase("", footerFont));
    rightCell.setBorder(Rectangle.NO_BORDER);
    rightCell.setBorderWidth(1f);

    PdfPTable table = new PdfPTable(3);
    table.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    table.setWidthPercentage(100f);
    table.addCell(leftCell);
    table.addCell(centerCell);
    table.addCell(rightCell);
    table.setWidths(new float[] { 0.3f, 0.3f, 0.3f });
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterUnterschriftenLine(Font footerFont) throws DocumentException {
    PdfPCell leftCell = new PdfPCell(new Phrase("Schulleiter(in)", footerFont));
    leftCell.setBorder(Rectangle.TOP);
    leftCell.setBorderWidth(1f);//from w  w  w.  j av a 2  s  .com
    leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
    centerCell.setBorder(Rectangle.TOP);
    centerCell.setBorderWidth(1f);
    centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell rightCell = new PdfPCell(new Phrase("Klassenleiter(in)", footerFont));
    rightCell.setBorder(Rectangle.TOP);
    rightCell.setBorderWidth(1f);
    rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);
    table.addCell(leftCell);
    table.addCell(centerCell);
    table.addCell(rightCell);
    table.setWidths(new float[] { 0.3f, 0.3f, 0.3f });
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterKenntnisLine(Font footerFont) {
    PdfPCell cell = new PdfPCell(new Phrase("Kenntnis genommen: Erziehungsberechtigte", footerFont));
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(1f);//from  w  w w  . ja va2  s.c  o m
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    PdfPTable table = new PdfPTable(1);
    table.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.setWidthPercentage(100f);
    table.addCell(cell);
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterHalbjahrDatumLine(String datumString, Font footerFont)
        throws DocumentException {
    PdfPCell leftCell = new PdfPCell(new Phrase(datumString, footerFont));
    leftCell.setBorder(Rectangle.NO_BORDER);
    leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
    centerCell.setBorder(Rectangle.NO_BORDER);
    centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell rightCell = new PdfPCell(new Phrase("", footerFont));
    rightCell.setBorder(Rectangle.NO_BORDER);
    rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);/*  w w  w. j a  v a2 s .  co  m*/
    table.addCell(leftCell);
    table.addCell(centerCell);
    table.addCell(rightCell);
    table.setWidths(new float[] { 0.3f, 0.3f, 0.3f });
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterHalbjahrDatumKlassenleiterLine(Font footerFont) throws DocumentException {
    PdfPCell leftCell = new PdfPCell(new Phrase("Datum", footerFont));
    leftCell.setBorder(Rectangle.TOP);
    leftCell.setBorderWidth(1f);/*  w  w  w. j  av  a  2 s.  co  m*/
    leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
    centerCell.setBorder(Rectangle.TOP);
    centerCell.setBorderWidth(1f);
    centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell rightCell = new PdfPCell(new Phrase("Klassenleiter(in)", footerFont));
    rightCell.setBorder(Rectangle.TOP);
    rightCell.setBorderWidth(1f);
    rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);
    table.addCell(leftCell);
    table.addCell(centerCell);
    table.addCell(rightCell);
    table.setWidths(new float[] { 0.3f, 0.3f, 0.3f });
    return table;
}

From source file:org.ganttproject.impex.htmlpdf.itext.ThemeImpl.java

License:GNU General Public License

private void writeAttributes(PdfPTable table, LinkedHashMap<String, String> attrs) {
    for (Entry<String, String> nextEntry : attrs.entrySet()) {
        {//from   w  w  w .  j  a  va  2  s. c om
            Paragraph p = new Paragraph(nextEntry.getKey(), getSansRegularBold(12));
            PdfPCell cell = new PdfPCell(p);
            cell.setBorder(PdfPCell.NO_BORDER);
            table.addCell(cell);
        }
        {
            Paragraph p = new Paragraph(nextEntry.getValue(), getSansRegular(12));
            PdfPCell cell = new PdfPCell(p);
            cell.setBorder(PdfPCell.NO_BORDER);
            table.addCell(cell);
        }
    }
}

From source file:org.ganttproject.impex.htmlpdf.itext.ThemeImpl.java

License:GNU General Public License

private void writeTitlePage() throws DocumentException {
    Rectangle page = myDoc.getPageSize();
    PdfPTable head = new PdfPTable(1);
    PdfPTable colontitleTable = createColontitleTable(getProject().getProjectName(),
            GanttLanguage.getInstance().getMediumDateFormat().format(new Date()),
            getProject().getOrganization(), getProject().getWebLink());

    head.setTotalWidth(page.getWidth() - myDoc.leftMargin() - myDoc.rightMargin());
    {//from   ww w  .java  2  s. c o  m
        PdfPCell cell = new PdfPCell(colontitleTable);
        cell.setBorder(PdfPCell.NO_BORDER);
        head.addCell(cell);
    }
    addEmptyRow(head, 20);
    LinkedHashMap<String, String> attrs = new LinkedHashMap<>();
    attrs.put(i18n("label.project_manager"), buildManagerString());
    attrs.put(i18n("label.dates"), buildProjectDatesString());
    attrs.put(" ", " ");
    attrs.put(i18n("label.completion"), buildProjectCompletionString());
    attrs.put(i18n("label.tasks"), String.valueOf(getProject().getTaskManager().getTaskCount()));
    attrs.put(i18n("label.resources"),
            String.valueOf(getProject().getHumanResourceManager().getResources().size()));
    PdfPTable attrsTable = new PdfPTable(2);
    writeAttributes(attrsTable, attrs);
    PdfPCell attrsCell = new PdfPCell(attrsTable);
    attrsCell.setBorder(PdfPCell.NO_BORDER);
    head.addCell(attrsCell);
    addEmptyRow(head, 20);
    if (getProject().getDescription().length() > 0) {
        Paragraph p = new Paragraph(getProject().getDescription(), getSansRegular(12));
        PdfPCell cell = new PdfPCell(p);
        cell.setBorder(PdfPCell.TOP | PdfPCell.BOTTOM);
        cell.setBorderColor(SORTAVALA_GREEN);
        cell.setBorderWidth(1);
        cell.setPadding(5);
        cell.setVerticalAlignment(PdfPCell.ALIGN_CENTER);
        head.addCell(cell);
    }

    myDoc.add(head);
}

From source file:org.ganttproject.impex.htmlpdf.itext.ThemeImpl.java

License:GNU General Public License

private PdfPTable createTableHeader(ColumnList tableHeader, ArrayList<Column> orderedColumns) {
    for (int i = 0; i < tableHeader.getSize(); i++) {
        Column c = tableHeader.getField(i);
        if (c.isVisible()) {
            orderedColumns.add(c);/* w w  w.java 2s  . c o  m*/
        }
    }
    Collections.sort(orderedColumns, new Comparator<Column>() {
        @Override
        public int compare(Column lhs, Column rhs) {
            if (lhs == null || rhs == null) {
                return 0;
            }
            return lhs.getOrder() - rhs.getOrder();
        }
    });
    float[] widths = new float[orderedColumns.size()];
    for (int i = 0; i < orderedColumns.size(); i++) {
        Column column = orderedColumns.get(i);
        widths[i] = column.getWidth();
    }

    PdfPTable table = new PdfPTable(widths);
    table.setWidthPercentage(95);
    for (Column field : orderedColumns) {
        if (field.isVisible()) {
            PdfPCell cell = new PdfPCell(new Paragraph(field.getName(), getSansRegularBold(12f)));
            cell.setPaddingTop(4);
            cell.setPaddingBottom(4);
            cell.setPaddingLeft(5);
            cell.setPaddingRight(5);
            cell.setBorderWidth(0);
            cell.setBorder(PdfPCell.BOTTOM);
            cell.setBorderWidthBottom(1);
            cell.setBorderColor(SORTAVALA_GREEN);
            table.addCell(cell);
        }
    }
    table.setHeaderRows(1);
    return table;
}