Example usage for com.lowagie.text Font DEFAULTSIZE

List of usage examples for com.lowagie.text Font DEFAULTSIZE

Introduction

In this page you can find the example usage for com.lowagie.text Font DEFAULTSIZE.

Prototype

int DEFAULTSIZE

To view the source code for com.lowagie.text Font DEFAULTSIZE.

Click Source Link

Document

the value of the default size.

Usage

From source file:ec.edu.uce.erp.web.common.util.CustomPDFExporter.java

@Override
protected void addColumnFacets(DataTable table, PdfPTable pdfTable, ColumnType columnType) {

    for (UIColumn col : table.getColumns()) {
        if (!col.isRendered()) {
            continue;
        }//  w  w  w  .  ja v a  2  s .  com
        if (col instanceof DynamicColumn) {
            ((DynamicColumn) col).applyModel();
        }
        if (col.isExportable()) {
            addHeaderValue(pdfTable, col.getFacet(columnType.facet()),
                    FontFactory.getFont(FontFactory.TIMES, "iso-8859-1", Font.DEFAULTSIZE, Font.BOLD));
        }
    }
}

From source file:fr.opensagres.odfdom.converter.pdf.internal.stylable.StylableParagraph.java

License:Open Source License

public void applyStyles(Style style) {
    this.lastStyleApplied = style;

    StyleTextProperties textProperties = style.getTextProperties();
    if (textProperties != null) {
        // font//from w  w w. j a  va  2 s  . co m
        Font font = textProperties.getFont();
        if (font != null) {
            super.setFont(font);
        }
    }

    StyleParagraphProperties paragraphProperties = style.getParagraphProperties();
    if (paragraphProperties != null) {
        // break-before
        StyleBreak breakBefore = paragraphProperties.getBreakBefore();
        if (breakBefore != null) {
            handleBreak(breakBefore);
        }

        // alignment
        int alignment = paragraphProperties.getAlignment();
        if (alignment != Element.ALIGN_UNDEFINED) {
            super.setAlignment(alignment);
        }

        // first line indentation
        Boolean autoTextIndent = paragraphProperties.getAutoTextIndent();
        if (Boolean.TRUE.equals(autoTextIndent)) {
            float fontSize = font != null ? font.getCalculatedSize() : Font.DEFAULTSIZE;
            super.setFirstLineIndent(1.3f * fontSize);
        } else {
            Float textIndent = paragraphProperties.getTextIndent();
            if (textIndent != null) {
                // text indent can be negative. 
                // See https://code.google.com/p/xdocreport/issues/detail?id=366 
                super.setFirstLineIndent(textIndent);
            }
        }

        // line height
        StyleLineHeight lineHeight = paragraphProperties.getLineHeight();
        if (lineHeight != null && lineHeight.getLineHeight() != null) {
            if (lineHeight.isLineHeightProportional()) {
                super.setMultipliedLeading(lineHeight.getLineHeight());
            } else {
                super.setLeading(lineHeight.getLineHeight());
            }
        }

        // keep together on the same page
        Boolean keepTogether = paragraphProperties.getKeepTogether();
        if (keepTogether != null) {
            super.setKeepTogether(keepTogether);
        }
    }
}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected void createCertificate() throws DocumentException {
    final Paragraph headerTextPara = new Paragraph(new Chunk(pdfLabel.get("contractorbill.pdf.contractorbill"),
            new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD)));
    headerTextPara.setAlignment(Element.ALIGN_CENTER);
    document.add(headerTextPara);//  w ww  .j  ava2  s .  c o m
    final Paragraph certificateheaderTextPara = new Paragraph(new Chunk(
            pdfLabel.get("contractorbill.pdf.certificate"), new Font(Font.COURIER, LARGE_FONT, Font.BOLD)));
    certificateheaderTextPara.setAlignment(Element.ALIGN_CENTER);
    document.add(certificateheaderTextPara);
    document.add(spacer());
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent1")));
    document.add(spacer());
    document.add(spacer());

    document.add(rightPara(
            pdfLabel.get("contractorbill.pdf.juniorengineer") + "\t \t\t \t \t \t\t \t\t \t \t \t \t"));
    document.add(spacer());
    document.add(rightPara(pdfLabel.get(dateLabel) + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t"
            + "\t \t\t \t\t \t \t \t \t\t \t\t\t\t \t\t \t\t"));
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent2")));
    document.add(spacer());
    document.add(spacer());

    document.add(rightPara(pdfLabel.get("contractorbill.pdf.exeasstengineer") + "\t \t"));
    document.add(spacer());
    document.add(rightPara(pdfLabel.get(dateLabel) + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t"
            + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t\t \t \t\t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t"));

    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent3")));
    document.add(spacer());
    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent4")));
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent5")));
    document.add(spacer());
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent6")));

    document.add(spacer());
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.juniorengineer")
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t " + tab2 + tab2
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t"
            + pdfLabel.get("contractorbill.pdf.exeasstengineer")));
    document.add(spacer());
    document.add(makePara(pdfLabel.get(dateLabel)
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + tab2 + tab2
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t"
            + "\t \t \t \t \t \t \t \t " + pdfLabel.get(dateLabel)));
}

From source file:org.odftoolkit.odfdom.converter.internal.itext.stylable.StylableParagraph.java

License:Open Source License

public void applyStyles(Style style) {
    this.lastStyleApplied = style;

    StyleTextProperties textProperties = style.getTextProperties();
    if (textProperties != null) {
        // Font/*  ww  w  .java  2 s  .  c  o m*/
        Font font = textProperties.getFont();
        if (font != null) {
            super.setFont(font);
        }
    }

    StyleParagraphProperties paragraphProperties = style.getParagraphProperties();
    if (paragraphProperties != null) {
        // break-before
        StyleBreak breakBefore = paragraphProperties.getBreakBefore();
        if (breakBefore != null) {
            handleBreak(breakBefore);
        }

        // alignment
        int alignment = paragraphProperties.getAlignment();
        if (alignment != Element.ALIGN_UNDEFINED) {
            super.setAlignment(alignment);
        }

        // paragraph indentation
        Float margin = paragraphProperties.getMargin();
        if (margin != null) {
            super.setIndentationLeft(margin);
            super.setIndentationRight(margin);
            super.setSpacingBefore(margin);
            super.setSpacingAfter(margin);
        }
        Float marginLeft = paragraphProperties.getMarginLeft();
        if (marginLeft != null) {
            super.setIndentationLeft(marginLeft);
        }
        Float marginRight = paragraphProperties.getMarginRight();
        if (marginRight != null) {
            super.setIndentationRight(marginRight);
        }
        Float marginTop = paragraphProperties.getMarginTop();
        if (marginTop != null) {
            super.setSpacingBefore(marginTop);
        }
        Float marginBottom = paragraphProperties.getMarginBottom();
        if (marginBottom != null) {
            super.setSpacingAfter(marginBottom);
        }

        // first line indentation
        Boolean autoTextIndent = paragraphProperties.getAutoTextIndent();
        if (Boolean.TRUE.equals(autoTextIndent)) {
            float fontSize = font != null ? font.getCalculatedSize() : Font.DEFAULTSIZE;
            super.setFirstLineIndent(1.3f * fontSize);
        } else {
            Float textIndent = paragraphProperties.getTextIndent();
            if (textIndent != null) {
                super.setFirstLineIndent(textIndent);
            }
        }

        // line height
        StyleLineHeight lineHeight = paragraphProperties.getLineHeight();
        if (lineHeight != null && lineHeight.getLineHeight() != null) {
            if (lineHeight.isLineHeightProportional()) {
                super.setMultipliedLeading(lineHeight.getLineHeight());
            } else {
                super.setLeading(lineHeight.getLineHeight());
            }
        }

        // keep together on the same page
        Boolean keepTogether = paragraphProperties.getKeepTogether();
        if (keepTogether != null) {
            super.setKeepTogether(keepTogether);
        }

        // background color
        Color backgroundColor = paragraphProperties.getBackgroundColor();
        if (backgroundColor != null) {
            getWrapperCell().setBackgroundColor(backgroundColor);
        }

        // border
        StyleBorder border = paragraphProperties.getBorder();
        if (border != null) {
            StyleUtils.applyStyles(border, getWrapperCell());
        }

        // border-left
        StyleBorder borderLeft = paragraphProperties.getBorderLeft();
        if (borderLeft != null) {
            StyleUtils.applyStyles(borderLeft, getWrapperCell());
        }

        // border-right
        StyleBorder borderRight = paragraphProperties.getBorderRight();
        if (borderRight != null) {
            StyleUtils.applyStyles(borderRight, getWrapperCell());
        }

        // border-top
        StyleBorder borderTop = paragraphProperties.getBorderTop();
        if (borderTop != null) {
            StyleUtils.applyStyles(borderTop, getWrapperCell());
        }

        // border-bottom
        StyleBorder borderBottom = paragraphProperties.getBorderBottom();
        if (borderBottom != null) {
            StyleUtils.applyStyles(borderBottom, getWrapperCell());
        }
    }
}

From source file:org.openswing.swing.export.java.ExportToPDFCallbacks14Impl.java

License:Open Source License

/**
 * @param attributeName attribute name that identify column header
 * @return Font to set for the specified column header
 *///from  w w w .j a  v a2s .c  o  m
public Object getHeaderFont(String attributeName) {
    return new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.BOLD);
}

From source file:org.primefaces.component.export.PDFExporter.java

License:Open Source License

protected PdfPTable exportPDFTable(FacesContext context, DataTable table, boolean pageOnly,
        boolean selectionOnly, String encoding) {
    int columnsCount = getColumnsCount(table);
    PdfPTable pdfTable = new PdfPTable(columnsCount);
    this.cellFont = FontFactory.getFont(FontFactory.TIMES, encoding);
    this.facetFont = FontFactory.getFont(FontFactory.TIMES, encoding, Font.DEFAULTSIZE, Font.BOLD);

    if (this.expOptions != null) {
        applyFacetOptions(this.expOptions);
        applyCellOptions(this.expOptions);
    }/*from  w  w  w  .j  av  a 2  s  .  c  o  m*/

    addTableFacets(context, table, pdfTable, "header");

    addColumnFacets(table, pdfTable, ColumnType.HEADER);

    if (pageOnly) {
        exportPageOnly(context, table, pdfTable);
    } else if (selectionOnly) {
        exportSelectionOnly(context, table, pdfTable);
    } else {
        exportAll(context, table, pdfTable);
    }

    if (table.hasFooterColumn()) {
        addColumnFacets(table, pdfTable, ColumnType.FOOTER);
    }

    addTableFacets(context, table, pdfTable, "footer");

    table.setRowIndex(-1);

    return pdfTable;
}

From source file:org.webguitoolkit.ui.util.export.PDFTableExport.java

License:Apache License

/**
 * @param table//from   w ww  . j  a  va2s.  c o m
 * @param footer
 * @param header
 * @return
 */
public PdfPTable pdfExport(Table table) {
    TableExportOptions exportOptions = table.getExportOptions();
    boolean showOnlyDisplayed = exportOptions.isShowOnlyDisplayedColumns();
    Font headfont = new Font(Font.UNDEFINED, Font.DEFAULTSIZE, Font.BOLD);

    Font bodyfont = new Font(exportOptions.getPdfFontSize(), exportOptions.getPdfFontSize(), Font.NORMAL);
    if (exportOptions.getPdfFontColour() != null) {
        Color fontColor = exportOptions.getPdfFontColour();
        bodyfont.setColor(fontColor);
        headfont.setColor(fontColor);
    }

    List<ITableColumn> columns = getTableColumns(showOnlyDisplayed, table);
    int columnCount = 0;
    for (int i = 0; i < columns.size(); i++) {
        TableColumn c = (TableColumn) columns.get(i);
        //hide select checkbox column
        if (!c.isExporatble())
            continue;

        columnCount++;

    }
    PdfPTable resulttable = new PdfPTable(columnCount);
    resulttable.setWidthPercentage(100f);

    if (StringUtils.isNotEmpty(exportOptions.getTableHeadline())) {
        PdfPCell cell = new PdfPCell(new Paragraph(exportOptions.getTableHeadline()));
        cell.setColspan(columns.size());
        cell.setBackgroundColor(Color.lightGray);
        resulttable.addCell(cell);
    }

    for (int i = 0; i < columns.size(); i++) {
        TableColumn c = (TableColumn) columns.get(i);
        // hide select checkbox column
        if (!c.isExporatble())
            continue;

        String cellData = TextService.getString(c.getTitle());
        if (cellData.contains("<br/>") || cellData.contains("<br>")) {
            cellData = cellData.replaceAll("<br\\/>", "\\/");
            cellData = cellData.replaceAll("<br>", "\\/");
        }
        PdfPCell cell = new PdfPCell(new Paragraph((cellData), headfont));
        cell.setBackgroundColor(Color.lightGray);
        resulttable.addCell(cell);

    }

    List tabledata = table.getDefaultModel().getFilteredList();
    if (tabledata.isEmpty()) {
        for (int i = 0; i < columns.size(); i++) {
            resulttable.addCell(new PdfPCell((new Phrase(""))));
        }
    }

    for (Iterator it = tabledata.iterator(); it.hasNext();) {
        DataBag dbag = (DataBag) it.next();
        for (int i = 0; i < columns.size(); i++) {
            TableColumn tableColumn = (TableColumn) columns.get(i);
            if (!tableColumn.isExporatble())
                continue;
            logger.debug("property: " + tableColumn.getProperty());
            IColumnRenderer renderer = tableColumn.getRenderer();
            Converter converter = tableColumn.getConverter();

            addObjectCell(bodyfont, resulttable, dbag, tableColumn, renderer, converter);
        }
    }

    if (StringUtils.isNotEmpty(exportOptions.getTableFooter())) {
        PdfPCell cell = new PdfPCell(new Paragraph(exportOptions.getTableFooter()));
        cell.setColspan(columnCount);
        cell.setBackgroundColor(Color.lightGray);
        resulttable.addCell(cell);
    }

    resulttable.setHeaderRows(1);
    return resulttable;

}