Example usage for com.lowagie.text Font Font

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

Introduction

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

Prototype


public Font() 

Source Link

Document

Constructs a Font.

Usage

From source file:org.apache.maven.doxia.module.itext.ITextFont.java

License:Apache License

/**
 * Convenience method to get a defined font depending the wanted style and size.
 *
 * @param style the font style.//from   www  .ja va  2 s .  c om
 * @param size the font size.
 * @param color the font color.
 * @return a font the font.
 */
public static Font getFont(int style, float size, Color color) {
    Font font = new Font();
    font.setFamily(DEFAULT_FONT_NAME);
    font.setStyle(style);
    font.setSize(size);
    font.setColor(color);
    return font;
}

From source file:org.areasy.common.doclet.utilities.PDFUtility.java

License:Open Source License

/**
 * Creates a local destination chunk.//from   ww  w .ja va2 s  .  c  om
 *
 * @param destination The name of the local destination.
 * @return The chunk that can be inserted as an anchor.
 */
public static Chunk createAnchor(String destination) {
    return createAnchor(destination, new Font());
}

From source file:org.egov.works.utils.AbstractPDFGenerator.java

License:Open Source License

protected Paragraph makeParaWithFont(final float fontSize, final Object value, final int alignment) {
    final Font font = new Font();
    font.setSize(fontSize);/*from  ww w.j a v a2 s. c  om*/
    final Paragraph header = new Paragraph(value == null ? "" : value.toString(), font);
    header.setAlignment(alignment);
    return header;
}

From source file:org.egov.works.utils.AbstractPDFGenerator.java

License:Open Source License

protected Paragraph makeParaWithFont(final float fontSize, final Object value) {
    final Font font = new Font();
    font.setSize(fontSize);/* w  w w.j  av  a 2s.  com*/
    return new Paragraph(value == null ? "" : value.toString(), font);
}

From source file:org.egov.works.utils.AbstractPDFGenerator.java

License:Open Source License

protected Paragraph makePara(final float size, final Object value) {
    final Font font = new Font();
    font.setSize(size);/*from ww w . j  a v a  2  s .  c om*/
    return new Paragraph(value == null ? "" : value.toString(), font);
}

From source file:org.egov.works.utils.AbstractPDFGenerator.java

License:Open Source License

protected Paragraph rightPara(final float size, final Object value) {
    final Font font = new Font();
    font.setSize(size);//from   w w w  . j  av a  2s. co  m
    final Paragraph header = new Paragraph(value == null ? "" : value.toString(), font);
    header.setAlignment(Element.ALIGN_RIGHT);
    return header;
}

From source file:org.egov.works.web.actions.measurementbook.MeasurementBookPDFGenerator.java

License:Open Source License

private PdfPTable createMbTable() throws DocumentException {
    PdfPTable mbTable;//from   w ww.  ja  v  a  2  s . c  o  m
    if (includeRevisionTypeColumn) {
        mbTable = new PdfPTable(12);
        mbTable.setWidths(new float[] { 1f, 1.5f, 4f, 1.4f, 1.9f, 1.6f, 1.4f, 1.8f, 1.9f, 1.9f, 1.9f, 1.6f });
    } else {
        mbTable = new PdfPTable(11);
        mbTable.setWidths(new float[] { 1f, 1.5f, 4f, 1.9f, 1.6f, 1.4f, 1.8f, 1.9f, 1.9f, 1.9f, 1.6f });
    }
    // main table
    mbTable.setWidthPercentage(100);

    try {
        final Font font = new Font();
        font.setSize(8);
        mbTable.getDefaultCell().setPadding(3);
        mbTable.getDefaultCell().setBorderWidth(1);
        mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.slno"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.schno"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.descofwork"), font)));
        if (includeRevisionTypeColumn)
            mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.revisiontype"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.completedmeasurement"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.unitrate"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.unit"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.totalvalueofcomplwork"), font)));

        // start creating tables for previous measurements
        final PdfPTable previousMbTable = createPreviousMbTable();
        final PdfPCell previousMbCell = new PdfPCell(previousMbTable);
        previousMbCell.setColspan(2);
        mbTable.addCell(previousMbCell);

        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.currentmeasurement"), font)));

        // last column
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.currentcost"), font)));
    } catch (final RuntimeException e) {
        throw new ApplicationRuntimeException(MEASUREMENTBOOK_PDF_ERROR, e);
    }
    return mbTable;
}

From source file:org.egov.works.web.actions.measurementbook.MeasurementBookPDFGenerator.java

License:Open Source License

public PdfPTable createPreviousMbTable() {
    final PdfPTable previousMbTable = new PdfPTable(2);
    final Font font = new Font();
    font.setSize(8);/*from   www  .  j  a v a  2 s.co  m*/
    previousMbTable.getDefaultCell().setBorderWidth(1);
    previousMbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    previousMbTable.getDefaultCell().setColspan(2);
    previousMbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.previousmeasurement"), font)));
    previousMbTable.getDefaultCell().setColspan(1);
    previousMbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.pageno"), font)));
    previousMbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.measurements"), font)));
    return previousMbTable;
}