Example usage for com.itextpdf.text Element ALIGN_CENTER

List of usage examples for com.itextpdf.text Element ALIGN_CENTER

Introduction

In this page you can find the example usage for com.itextpdf.text Element ALIGN_CENTER.

Prototype

int ALIGN_CENTER

To view the source code for com.itextpdf.text Element ALIGN_CENTER.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:com.softwaremagico.tm.pdf.complete.skills.SkillsTable.java

License:Open Source License

protected static PdfPCell createSkillValue(Integer value, boolean special, boolean modified, int fontSize) {
    if (value == null) {
        return createSkillLine(SKILL_VALUE_GAP, fontSize);
    }/* w  w  w  .  j a  v  a  2s  .c  o m*/
    PdfPCell cell = getCell(value + (special ? "*" : "") + (modified && value > 0 ? "!" : ""), 0, 1,
            Element.ALIGN_CENTER, BaseColor.WHITE, FadingSunsTheme.getHandwrittingFont(),
            FadingSunsTheme.getHandWrittingFontSize(fontSize));
    cell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / ROWS));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.traits.VictoryPointsTable.java

License:Open Source License

private static PdfPCell createLine(String text, BaseColor color) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFont(),
            FadingSunsTheme.VICTORY_POINTS_FONT_SIZE);
    cell.setMinimumHeight(11);//from ww w  .j a v a2 s  .  c o  m
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.traits.VictoryPointsTable.java

License:Open Source License

private static PdfPCell createSubTitle(String text, BaseColor color) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color,
            FadingSunsTheme.getLineFontBold(), FadingSunsTheme.VICTORY_POINTS_FONT_SIZE);
    cell.setMinimumHeight(13);/*from   w ww  . j a va 2s  .  c om*/
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.small.characteristics.CharacteristicsTableFactory.java

License:Open Source License

public static PdfPTable getCharacteristicsBasicsTable(CharacterPlayer characterPlayer) {
    float[] widths = { 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);//www .  j  a  v  a  2  s . c om
    table.getDefaultCell().setBorder(0);

    Phrase content = new Phrase(getTranslator().getTranslatedText("characteristics"),
            new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_SMALL_TITLE_FONT_SIZE));
    PdfPCell titleCell = new PdfPCell(content);
    setCellProperties(titleCell);
    titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    titleCell.setColspan(widths.length);
    titleCell.setFixedHeight(30);
    table.addCell(titleCell);
    table.getDefaultCell().setPadding(0);

    for (CharacteristicType type : CharacteristicType.values()) {
        table.addCell(new CharacteristicsColumn(characterPlayer, type,
                CharacteristicsDefinitionFactory.getInstance().getAll(type, Translator.getLanguage())));
    }

    return table;
}

From source file:com.softwaremagico.tm.pdf.small.counters.CounterTable.java

License:Open Source License

protected PdfPCell createValue(String text, Font font, int alignment) {
    Phrase content = new Phrase(text, font);
    PdfPCell circleCell = new PdfPCell(content);
    // Not putting correctly the "o" at the center of the cell.
    // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment
    circleCell.setPaddingTop(paddingTop);
    circleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    circleCell.setVerticalAlignment(alignment);
    circleCell.setBorder(0);/*  w  w w  .  java  2 s .c o  m*/
    circleCell.setMinimumHeight(20);
    return circleCell;
}

From source file:com.softwaremagico.tm.pdf.small.victorytable.VerticalVictoryPointsTable.java

License:Open Source License

private static PdfPCell createLine(String text, BaseColor color) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFont(),
            FadingSunsTheme.VICTORY_SMALL_POINTS_FONT_SIZE);
    cell.setMinimumHeight(12);/* w w w  . ja  v a  2 s .co  m*/
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.small.victorytable.VerticalVictoryPointsTable.java

License:Open Source License

private static PdfPCell createSubTitle(String text, BaseColor color) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color,
            FadingSunsTheme.getLineFontBold(), FadingSunsTheme.VICTORY_SMALL_POINTS_FONT_SIZE + 1);
    cell.setMinimumHeight(18);/*  w w w. j  a v a  2s .  c o  m*/
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertCellAlteracao(PdfPTable table, String text) {

     if (text == null) {
         text = "";
     }//  w  w  w.ja  v  a  2s  .co m

     // create a new cell with the specified Text and Font
     PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
     // set the cell alignment
     // in case there is no text and you wan to create an empty row
     if (text.trim().equalsIgnoreCase("")) {
         cell.setMinimumHeight(10f);
     }

     cell.setHorizontalAlignment(Element.ALIGN_CENTER);
     cell.setColspan(2);
     cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
     cell.setBorderWidth(2);
     cell.setPadding(3f);

     // add the call to the table
     table.addCell(cell);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertHeaderCell(PdfPTable table, String text, Integer colSpan) {

     if (text == null) {
         text = "";
     }//  w ww . j  a  v a 2 s  .co m

     // create a new cell with the specified Text and Font
     PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
     // set the cell alignment
     // in case there is no text and you wan to create an empty row
     if (text.trim().equalsIgnoreCase("")) {
         cell.setMinimumHeight(10f);
     }

     cell.setVerticalAlignment(Element.ALIGN_CENTER);
     cell.setHorizontalAlignment(Element.ALIGN_CENTER);
     cell.setColspan(colSpan);
     cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
     cell.setBorderWidth(2);
     cell.setPadding(3f);

     // add the call to the table
     table.addCell(cell);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private Paragraph createHeader() {
     Paragraph anexo = new Paragraph("ANEXO IV" + SEPARATOR + "REQUERIMENTO - HABILITAO DE PESSOA JUR?DICA",
             FONT_BIG_HEADER_BOLD);// w w  w .  ja v  a 2  s .c om
     anexo.setAlignment(Element.ALIGN_CENTER);

     Paragraph law = new Paragraph("( Lei n 10.357, de 27 de dezembro de 2001)" + SEPARATOR_DOUBLE,
             FONT_BIG_HEADER);
     law.setAlignment(Element.ALIGN_CENTER);

     Paragraph full = new Paragraph();
     full.add(anexo);
     full.add(law);

     return full;
 }