Example usage for com.itextpdf.text Font Font

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

Introduction

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

Prototype


public Font(final FontFamily family, final float size) 

Source Link

Document

Constructs a Font.

Usage

From source file:printers.AbstractHorariosPrinter.java

License:Open Source License

private PdfPCell createCeldaDiasSemana(String texto) {
    Font font = new Font(Font.FontFamily.HELVETICA, 14);
    Paragraph p = new Paragraph(texto, font);
    p.setAlignment(Paragraph.ALIGN_CENTER);
    PdfPCell c = new PdfPCell(p);
    c.setGrayFill(.9f);//from ww  w .  ja  va 2 s  .co  m
    c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    c.setVerticalAlignment(PdfPCell.ALIGN_CENTER);
    return c;
}

From source file:printers.AbstractHorariosPrinter.java

License:Open Source License

/**
 *
 * @param h//from  w ww. java2s  . com
 * @return
 */
protected Paragraph getParagraphForAsignatura(HorarioItem h) {
    Font font = new Font(Font.FontFamily.HELVETICA, 8);
    Paragraph p = new Paragraph(h.getAsignatura().getNombre(), font);
    //        BaseFont bf;
    //        try {
    //            bf = BaseFont.createFont(
    //                    BaseFont.TIMES_ROMAN,
    //                    BaseFont.CP1252,
    //                    BaseFont.EMBEDDED);
    //            Font font = new Font(bf, 6);
    //            p = new Paragraph(h.getAsignatura().getNombre(), font);
    //        } catch (DocumentException ex) {
    //            Logger.getLogger(AbstractPrinter.class.getName()).log(Level.SEVERE, null, ex);
    //        } catch (IOException ex) {
    //            Logger.getLogger(AbstractPrinter.class.getName()).log(Level.SEVERE, null, ex);
    //        }
    return p;
}

From source file:printers.HojaDeFirmaPrinter.java

License:Open Source License

private void creaCabecera(Document doc, Aula aula, GregorianCalendar dia) throws DocumentException {
    AcademicCalendar cal = dp.getAcademicCalendar();
    Font font = new Font(Font.FontFamily.HELVETICA, 16);
    Font fontbold = new Font(Font.FontFamily.HELVETICA, 16, Font.BOLD);
    String diaSemana = cal.nombreDiaSemana(dia);
    Paragraph par = new Paragraph();
    par.add(new Phrase("Hoja de firma para aula ", font));
    par.add(new Phrase(aula.getNombre(), fontbold));
    par.add(new Phrase(" correspondiente al da ", font));
    par.add(new Phrase(diaSemana + " " + cal.format(dia), fontbold));

    par.setAlignment(Paragraph.ALIGN_CENTER);
    doc.add(par);/*w w w . j av  a 2s  .  c  o m*/
    par.setAlignment(Paragraph.ALIGN_CENTER);
}

From source file:printers.HojaDeFirmaPrinter.java

License:Open Source License

/**
 *
 * @param t//from www  .j a v a 2 s .  c  o  m
 * @param h
 */
protected void creaFilaFirma(PdfPTable t, HorarioItem h) {
    Font font = new Font(Font.FontFamily.HELVETICA, 12);
    Font fontProfe = new Font(Font.FontFamily.HELVETICA, 10);
    String name = h.getRangoHoras() + "\n" + h.getAsignatura().getNombre();
    name += "\n" + h.getGrupo().getNombreGrupoCursoYCarrera();
    Paragraph p = new Paragraph(name, font);
    PdfPCell c = new PdfPCell(p);
    c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    c.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    c.setPadding(5);
    c.setFixedHeight(60);
    t.addCell(c);
    String nombreProfesor = h.getProfesor().getNombre() + " " + h.getProfesor().getApellidos();
    p = new Paragraph(nombreProfesor + ":", fontProfe);
    c = new PdfPCell(p);
    c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    c.setPadding(5);
    t.addCell(c);
    t.addCell("");
}

From source file:printers.PrinterHorarioPorGrupos.java

License:Open Source License

/**
 *
 * @param doc/*from  w ww  . j  a v a2 s .com*/
 * @param obj
 * @throws DocumentException
 */
@Override
public void printCabecera(Document doc, Object obj) throws DocumentException {
    CarreraCursoGrupoContainer cont = (CarreraCursoGrupoContainer) obj;
    addTitle(doc);
    doc.add(new Paragraph());

    Font fontSubtitle = new Font(Font.FontFamily.HELVETICA, 16);
    String texto = "Horarios para %s";
    texto = texto.replace("%s", cont.getNombre());
    Paragraph par = new Paragraph(texto, fontSubtitle);
    par.setAlignment(Paragraph.ALIGN_CENTER);
    doc.add(par);
    //        doc.add(new LineSeparator());
    doc.add(new Paragraph());
}

From source file:printers.PrinterHorariosPorAulas.java

License:Open Source License

/**
     *//from ww w  . j a  v  a 2s  .c  o  m
     * @param h
     * @return
     */
    @Override
    protected Paragraph getParagraphForAsignatura(HorarioItem h) {
        Font font = new Font(Font.FontFamily.HELVETICA, 10);
        return new Paragraph(
                h.getAsignatura().getNombre() + "\nG." + h.getGrupo().getNombre() + "\n" + h.getProfesor(), font);
    }

From source file:printers.PrinterHorariosPorProfesor.java

License:Open Source License

/**
 *
 * @param h//from  w ww.j a  v a2  s .  com
 * @return
 */
@Override
protected Paragraph getParagraphForAsignatura(HorarioItem h) {
    Font font = new Font(Font.FontFamily.HELVETICA, 8);
    return new Paragraph(
            h.getAsignatura().getNombre() + " (G." + h.getGrupo().getNombre() + ")\n" + h.getAula(), font);
}