Example usage for com.itextpdf.text FontFactory TIMES

List of usage examples for com.itextpdf.text FontFactory TIMES

Introduction

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

Prototype

String TIMES

To view the source code for com.itextpdf.text FontFactory TIMES.

Click Source Link

Document

This is a possible value of a base 14 type 1 font

Usage

From source file:imprimer.java

public void openPDF() {

    Document document = new Document(PageSize.A4);
    try {//from   www  .j  a va  2 s .co m
        PdfWriter.getInstance(document, new FileOutputStream("imprimer test.pdf"));

        document.open();

        imagee(document);

        SimpleDateFormat td = new SimpleDateFormat("dd-MM-yyyy");
        java.util.Date now = new java.util.Date();
        String tdnow = td.format(now);
        Paragraph pa = new Paragraph("Attestation de travail",
                FontFactory.getFont(FontFactory.TIMES, 30, Font.UNDERLINE, BaseColor.DARK_GRAY));
        pa.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(pa);
        for (int i = 0; i < 3; i++) {
            document.add(new Paragraph(" "));
        }

        Paragraph p = new Paragraph(text,
                FontFactory.getFont(FontFactory.TIMES, 16, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p);

        Paragraph time = new Paragraph("                Fait  Ouarzazate le : " + tdnow,
                FontFactory.getFont(FontFactory.TIMES, 17, Font.BOLD, BaseColor.DARK_GRAY));
        Paragraph a = new Paragraph("");
        Paragraph si = new Paragraph("                 Signature:",
                FontFactory.getFont(FontFactory.TIMES, 17, Font.BOLD, BaseColor.DARK_GRAY));

        time.setAlignment(Paragraph.ALIGN_CENTER);
        si.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(time);
        document.add(si);
        document.add(a);
        document.close();

        System.out.println("date2");
        /* Open Pdf */
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Desktop.Action.OPEN)) {
            desktop.open(new File("imprimer test.pdf"));
        } else {
            System.out.println("Open is not supported");
        }

        System.out.println("date");

    } catch (Exception ex) {
        System.out.println("qsdqs");
    }
}

From source file:imprimer.java

public void attestation_travail_prof() {

    Document document = new Document(PageSize.A4);
    try {/*from w w w.  j ava  2  s .  c o m*/
        PdfWriter.getInstance(document, new FileOutputStream("Attestation de travail Professeur.pdf"));
        document.open();

        imagee(document);
        SimpleDateFormat td = new SimpleDateFormat("dd-MM-yyyy");
        java.util.Date now = new java.util.Date();
        String tdnow = td.format(now);
        Paragraph pa = new Paragraph("Attestation de travail",
                FontFactory.getFont(FontFactory.TIMES, 30, Font.UNDERLINE, BaseColor.DARK_GRAY));
        pa.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(pa);
        for (int i = 0; i < 3; i++) {
            document.add(new Paragraph(" "));
        }

        Paragraph p = new Paragraph(text3,
                FontFactory.getFont(FontFactory.TIMES, 16, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p);

        Paragraph time = new Paragraph("                Fait  Ouarzazate le : " + tdnow,
                FontFactory.getFont(FontFactory.TIMES, 17, Font.BOLD, BaseColor.DARK_GRAY));
        Paragraph a = new Paragraph("");
        Paragraph si = new Paragraph("                 Signature:",
                FontFactory.getFont(FontFactory.TIMES, 17, Font.BOLD, BaseColor.DARK_GRAY));

        time.setAlignment(Paragraph.ALIGN_CENTER);
        si.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(time);
        document.add(si);
        document.add(a);
        document.close();

        System.out.println("date2");
        /* Open Pdf */
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Desktop.Action.OPEN)) {
            desktop.open(new File("Attestation de travail Professeur.pdf"));
        } else {
            System.out.println("Open is not supported");
        }

        System.out.println("date");
    } catch (Exception ex) {

        System.out.println("qsdqs");
    }
}

From source file:imprimer.java

public void conje() {
    Document document = new Document(PageSize.A4);
    try {/*from w  w w  .ja v  a  2 s  . c  o  m*/
        PdfWriter.getInstance(document, new FileOutputStream("conjee.pdf"));

        document.open();
        imagee(document);
        SimpleDateFormat td = new SimpleDateFormat("dd-MM-yyyy");
        java.util.Date now = new java.util.Date();
        String tdnow = td.format(now);
        Paragraph pa = new Paragraph("Dcision de cong",
                FontFactory.getFont(FontFactory.TIMES, 30, Font.UNDERLINE, BaseColor.DARK_GRAY));
        pa.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(pa);
        for (int i = 0; i < 4; i++) {
            document.add(new Paragraph(" "));
        }

        Paragraph p = new Paragraph(text2,
                FontFactory.getFont(FontFactory.TIMES, 14, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p);
        Paragraph p3 = new Paragraph("DECIDE :",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, BaseColor.DARK_GRAY));
        p3.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(p3);
        Paragraph p4 = new Paragraph("ARTICLE I Un cong dun .",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLDITALIC, BaseColor.DARK_GRAY));
        document.add(p4);
        Paragraph p5 = new Paragraph(
                "           Est accord    :    \n" + "           C.I.N           :    \n"
                        + "           GRADE           :    \n" + "           Pour la priode :   ",
                FontFactory.getFont(FontFactory.TIMES, 15, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p5);
        Paragraph p6 = new Paragraph("ARTICLE II",
                FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLDITALIC, BaseColor.DARK_GRAY));
        document.add(p6);
        Paragraph p7 = new Paragraph(
                "Lintress(e) est autoris  quitter le territoire national durant la priode indique ci-dessus",
                FontFactory.getFont(FontFactory.TIMES, 18, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p7);
        Paragraph p8 = new Paragraph("ARTICLE III",
                FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLDITALIC, BaseColor.DARK_GRAY));
        document.add(p8);
        Paragraph p9 = new Paragraph(
                "Lintress(e) est tenu daviser le service du personnel de sa reprise de travail aprs expiration du  cong sus-vis.",
                FontFactory.getFont(FontFactory.TIMES, 18, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p9);
        for (int i = 0; i < 4; i++) {
            document.add(new Paragraph(" "));
        }

        Paragraph time = new Paragraph(
                "             Cachet et signature                                        Fait  Ouarzazate le :"
                        + tdnow + "\n" + "\n",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, BaseColor.DARK_GRAY));

        Paragraph si = new Paragraph("Signature du demandeur",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, BaseColor.DARK_GRAY));
        time.setAlignment(Paragraph.ALIGN_LEFT);
        si.setAlignment(Paragraph.ALIGN_RIGHT);
        document.add(time);
        document.add(si);
        document.close();

        System.out.println("date2");
        /* Open Pdf */
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Desktop.Action.OPEN)) {
            desktop.open(new File("conjee.pdf"));
        } else {
            System.out.println("Open is not supported");
        }

        System.out.println("date");
    } catch (Exception ex) {

        System.out.println("qsdqs");
    }
}

From source file:imprimer.java

public void conje_exp() {
    Document document = new Document(PageSize.A4);
    try {/*from   ww w  .j a  v a  2  s  .c  om*/
        PdfWriter.getInstance(document, new FileOutputStream("conjee_exp.pdf"));

        document.open();
        imagee(document);
        SimpleDateFormat td = new SimpleDateFormat("dd-MM-yyyy");
        java.util.Date now = new java.util.Date();
        String tdnow = td.format(now);
        Paragraph pa = new Paragraph("Dcision de cong",
                FontFactory.getFont(FontFactory.TIMES, 30, Font.UNDERLINE, BaseColor.DARK_GRAY));
        pa.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(pa);
        for (int i = 0; i < 4; i++) {
            document.add(new Paragraph(" "));
        }

        Paragraph p = new Paragraph(text2,
                FontFactory.getFont(FontFactory.TIMES, 14, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p);
        Paragraph p3 = new Paragraph("DECIDE :",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, BaseColor.DARK_GRAY));
        p3.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(p3);
        Paragraph p4 = new Paragraph("ARTICLE I",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLDITALIC, BaseColor.DARK_GRAY));
        document.add(p4);
        Paragraph p5 = new Paragraph(
                "           Un cong Exceptionnel dune dure de jours\n"
                        + "           Est accord    :    \n" + "           C.I.N           :    \n"
                        + "           GRADE           :    \n" + "           Pour la priode :   ",
                FontFactory.getFont(FontFactory.TIMES, 15, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p5);
        Paragraph p6 = new Paragraph("ARTICLE II",
                FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLDITALIC, BaseColor.DARK_GRAY));
        document.add(p6);
        Paragraph p7 = new Paragraph(
                "Lintress(e) est autoris  quitter le territoire national durant la priode indique ci-dessus",
                FontFactory.getFont(FontFactory.TIMES, 18, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p7);
        Paragraph p8 = new Paragraph("ARTICLE III",
                FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLDITALIC, BaseColor.DARK_GRAY));
        document.add(p8);
        Paragraph p9 = new Paragraph(
                "Lintress(e) est tenu daviser le service du personnel de sa reprise de travail aprs expiration du  cong sus-vis.",
                FontFactory.getFont(FontFactory.TIMES, 18, Font.NORMAL, BaseColor.DARK_GRAY));
        document.add(p9);
        for (int i = 0; i < 4; i++) {
            document.add(new Paragraph(" "));
        }

        Paragraph time = new Paragraph(
                "             Cachet et signature                                        Fait  Ouarzazate le :"
                        + tdnow + "\n" + "\n",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, BaseColor.DARK_GRAY));

        Paragraph si = new Paragraph("Signature du demandeur",
                FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, BaseColor.DARK_GRAY));
        time.setAlignment(Paragraph.ALIGN_LEFT);
        si.setAlignment(Paragraph.ALIGN_RIGHT);
        document.add(time);
        document.add(si);
        document.close();

        System.out.println("date2");
        /* Open Pdf */
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Desktop.Action.OPEN)) {
            desktop.open(new File("conjee_exp.pdf"));
        } else {
            System.out.println("Open is not supported");
        }

        System.out.println("date");
    } catch (Exception ex) {

        System.out.println("qsdqs");
    }
}

From source file:imprimer.java

public void quitter_territoire() {

    Document document = new Document(PageSize.A4);
    try {// ww  w  . j  a  v  a2 s  .co m
        PdfWriter.getInstance(document, new FileOutputStream("quitter territoire.pdf"));

        document.open();
        imagee(document);

        document.open();
        imagee(document);
        SimpleDateFormat td = new SimpleDateFormat("dd-MM-yyyy");
        java.util.Date now = new java.util.Date();
        String tdnow = td.format(now);
        Paragraph pa = new Paragraph("Autorisation de quitter le territoire",
                FontFactory.getFont(FontFactory.TIMES, 30, Font.UNDERLINE, BaseColor.DARK_GRAY));
        pa.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(pa);
        for (int i = 0; i < 4; i++) {
            document.add(new Paragraph(" "));
        }

        //      cell = new PdfPCell(new Phrase("Fusion de 2 cellules de la premire colonne"));
        //      cell.setRowspan(2);
        //      table.addCell(cell);
        PdfPTable table = new PdfPTable(2);
        PdfPCell cell = new PdfPCell();
        //contenu du tableau.
        table.addCell("\nNom:\n\n");
        table.addCell("\n\n");
        table.addCell("\nPrenom:\n\n");
        table.addCell("\n\n");
        table.addCell("\nGRADE :\n\n");
        table.addCell("\n\n");
        table.addCell("\nADRESSE PERSONNELLE :\n\n");
        table.addCell("\n\n");
        table.addCell("\nAFFECTATION :\n\n");
        table.addCell("\n\n");

        cell = new PdfPCell(
                new Phrase("\nJai  lhonneur de solliciter une autorisation  dabsence.\n\n"));
        cell.setColspan(2);
        table.addCell(cell);

        table.addCell("\nDU:\n\n");
        table.addCell("\n\n");
        table.addCell("\nAU:\n\n");
        table.addCell("\n\n");
        table.addCell("\nMOTIF :\n\n");
        table.addCell("\n\n");
        table.addCell("\nAVIS DU  CHEF \nDETABLISSEMENT:\n\n");
        table.addCell("\n\nFAVORABLE.def\n\n");
        cell = new PdfPCell(new Phrase("\nFait  Ouarzazate le :" + tdnow + "\n\n"));
        cell.setColspan(2);

        table.addCell(cell);
        table.addCell("Signature du  demandeur\n\n\n\n\n\n\n\n\n");
        table.addCell("Cachet  et  signature\n\n\n\n\n\n\n\n");
        document.add(table);
        document.close();
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Desktop.Action.OPEN)) {
            desktop.open(new File("quitter territoire.pdf"));
        } else {
            System.out.println("Open is not supported");
        }

    } catch (Exception ex) {
        System.out.print("catch");
    }
}

From source file:com.algoboss.erp.util.report.PDFExporter.java

License:Apache License

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

    addColumnFacets(table, pdfTable, ColumnType.HEADER);

    if (pageOnly) {
        exportPageOnly(context, table, pdfTable);
    } else if (selectionOnly) {
        exportSelectionOnly(context, table, pdfTable);
    } else if (filteredOnly) {
        exportFilteredOnly(context, table, pdfTable);
    } else {/*w w  w . j  a  va 2 s . com*/
        exportAll(context, table, pdfTable);
    }

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

    table.setRowIndex(-1);

    return pdfTable;
}

From source file:com.centurylink.mdw.pdf.PdfExportHelper.java

License:Apache License

public PdfExportHelper(Project project) {
    super(project);
    chapterFont = FontFactory.getFont(FontFactory.TIMES, 20, Font.BOLD);
    sectionFont = FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLD);
    subSectionFont = FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD);
    normalFont = FontFactory.getFont(FontFactory.TIMES, 12, Font.NORMAL);
    boldFont = FontFactory.getFont(FontFactory.TIMES, 12, Font.BOLD);
    fixedWidthFont = FontFactory.getFont(FontFactory.COURIER, 11, Font.NORMAL);
}

From source file:com.centurylink.mdw.pdf.PdfExportHelper.java

License:Apache License

private void printActivity(Activity act, Chapter chapter) throws Exception {
    Section section;//from   w  ww .  ja  v a2s. c o  m
    String tmp = ACTIVITY + act.getLogicalId() + ": \"" + act.getName().replace('\n', ' ') + "\n";
    Paragraph sTitle = new Paragraph(tmp, sectionFont);
    section = chapter.addSection(sTitle, 2);
    String summary = act.getAttribute(WorkAttributeConstant.DESCRIPTION);
    if (summary != null && summary.length() > 0) {
        printBoldParagraphs(section, summary);
    }

    String detail = act.getAttribute(WorkAttributeConstant.DOCUMENTATION);
    if (detail != null && detail.length() > 0) {
        printHtmlParagraphs(section, detail, 2);
        section.add(new Paragraph("\n", FontFactory.getFont(FontFactory.TIMES, 4, Font.NORMAL)));
    }
    if (!act.getAttributes().isEmpty()) {
        printAttributes(section, act.getAttributes(), 2);
    }
    section.add(new Paragraph("\n", normalFont));
}

From source file:comedor.actions.OperacionesComedorAction.java

private void crearPDF() throws IOException, DocumentException {
    Restaurante restaurante = godr.obtenerDatosRestaurante();

    //Creamos el directorio donde almacenar los pdf sino existe
    File file = new File(RUTA_CUENTAS); //Especificamos la ruta
    if (!file.exists()) { //Si el directorio no existe
        if (file.mkdir()) { //Creamos el directorio
            //Le asignamos los permisos 777
            file.setExecutable(true);//ww w.  j a  va  2  s.  c o m
            file.setReadable(true);
            file.setExecutable(true);
        } else {
            System.err.println("Error al crear el directorio especificado");
            throw new IOException(); //Lanzamos una excepcion
        }
    }

    if (file.exists()) { //Si el directorio existe
        //Creamos el documento
        Document documento = new Document();
        //Creamos el OutputStream para el fichero pdf   
        FileOutputStream destino = new FileOutputStream(RUTA_CUENTAS + nombreDocumento);

        //Asociamos el FileOutputStream al Document
        PdfWriter.getInstance(documento, destino);
        //Abrimos el documento
        documento.open();

        //Aadimos el nombre del restaurante
        Font titulo = FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLDITALIC);
        Chunk chunk = new Chunk(restaurante.getNombre(), titulo);
        Paragraph parrafo = new Paragraph(chunk);
        parrafo.setAlignment(Element.ALIGN_CENTER);
        documento.add(parrafo);
        //Aadimos la imagen
        String path = request.getServletContext().getRealPath("/img/elvis.png");
        Image foto = Image.getInstance(path);
        foto.scaleToFit(100, 100);
        foto.setAlignment(Chunk.ALIGN_MIDDLE);
        documento.add(foto);
        //Aadimos los datos del restaurante
        Font datos = FontFactory.getFont(FontFactory.TIMES, 12, Font.NORMAL);
        chunk = new Chunk(getText("cuenta.cif") + ": " + restaurante.getCif(), datos);
        documento.add(new Paragraph(chunk));
        chunk = new Chunk(getText("cuenta.direccion") + ": " + restaurante.getDireccion(), datos);
        documento.add(new Paragraph(chunk));
        chunk = new Chunk(getText("cuenta.telefono") + ": " + restaurante.getTelefono(), datos);
        documento.add(new Paragraph(chunk));
        //Aadimos los datos de la cuenta
        chunk = new Chunk(getText("cuenta.cuentaId") + ": " + cuenta.getId(), datos);
        documento.add(new Paragraph(chunk));
        SimpleDateFormat formatoFecha = new SimpleDateFormat("dd-MM-yyyy");
        chunk = new Chunk(getText("cuenta.fecha") + ": " + formatoFecha.format(cuenta.getFecha()), datos);
        documento.add(new Paragraph(chunk));
        SimpleDateFormat formtoHora = new SimpleDateFormat("HH:mm:ss");
        chunk = new Chunk(getText("cuenta.hora") + ": " + formtoHora.format(cuenta.getFecha()), datos);
        documento.add(new Paragraph(chunk));
        //Aadimos los datos del pedido
        //Obtenemos el usuario, es decir, del camarero con el nombre que tenemos registrado en la session 
        chunk = new Chunk(getText("cuenta.camarero") + ": " + session.get("usuario").toString(), datos);
        documento.add(new Paragraph(chunk));
        documento.add(new Chunk(Chunk.NEWLINE)); //Salto de linea        
        //Aadimos la tabla con los datos del pedido
        //Creamos una tabla
        PdfPTable tabla = new PdfPTable(4); //Especificamos el numero de columnas
        //Aadimos la cabecera de la tabla
        tabla.addCell(getText("cuenta.producto"));
        tabla.addCell(getText("cuenta.unidades"));
        tabla.addCell(getText("cuenta.pvp"));
        tabla.addCell(getText("cuenta.total"));
        for (Producto producto : pedido.getListaProductos()) {
            tabla.addCell(producto.getNombre());
            tabla.addCell(String.valueOf(producto.getUnidades()));
            tabla.addCell(String.valueOf(producto.getPrecio()));
            tabla.addCell(String.valueOf(producto.getPrecio() * producto.getUnidades()));

            if (producto instanceof Hamburguesa) {
                Hamburguesa h = (Hamburguesa) producto;
                for (Producto extra : h.getListaProductosExtra()) {
                    tabla.addCell("(E) " + extra.getNombre());
                    tabla.addCell(String.valueOf(extra.getUnidades()));
                    tabla.addCell(String.valueOf(extra.getPrecio()));
                    tabla.addCell(String.valueOf(extra.getPrecio() * extra.getUnidades()));
                }
            }
        }
        //Aadimos la tabla al documento
        documento.add(tabla);
        documento.add(new Chunk(Chunk.NEWLINE)); //Salto de linea
        //Aadimos una tabla con los impuestos y el total a pagar
        tabla = new PdfPTable(3); //Especificamos el numero de columnas    
        tabla.addCell(getText("cuenta.baseImponible") + ": " + pedido.getImporte() + "");
        tabla.addCell("");
        tabla.addCell("");
        DecimalFormat formato = new DecimalFormat("#.##");
        for (Impuesto dato : listaImpuestos) {
            tabla.addCell("");
            tabla.addCell(dato.getNombre() + ": " + dato.getValor());
            double impuesto = (pedido.getImporte() * dato.getValor()) / 100;
            tabla.addCell(
                    getText("cuenta.impuesto") + " " + dato.getNombre() + ": " + formato.format(impuesto));
        }
        tabla.addCell(getText("cuenta.total") + ": " + cuenta.getCantidad() + "");
        tabla.addCell("");
        tabla.addCell("");
        //Aadimos la tabla al documento
        documento.add(tabla);

        //Cerramos el documento
        documento.close();

    } else { //Si el directoiro no existe
        System.err.println("OperacionesComedorAction. Error no existe el directorio especificado");
        throw new IOException(); //Lanzamos una excepcion
    }
}

From source file:cz.zcu.kiv.eegdatabase.logic.pdf.ReservationPDF.java

License:Apache License

public static PdfPTable formatReservation(Reservation reservation) {
    int padding = 5;

    GregorianCalendar created = new GregorianCalendar();
    created.setTime(reservation.getCreationTime());
    GregorianCalendar startTime = new GregorianCalendar();
    startTime.setTime(reservation.getStartTime());
    GregorianCalendar endTime = new GregorianCalendar();
    endTime.setTime(reservation.getEndTime());

    String personName = BookingRoomUtils.formatPersonName(reservation.getPerson());

    Font title = FontFactory.getFont("Trebuchet MS", "utf-8", 15, Font.BOLD, new BaseColor(59, 70, 00));
    Font header = FontFactory.getFont(FontFactory.TIMES_BOLD, 13, Font.BOLD, BaseColor.BLACK);
    Font value = FontFactory.getFont(FontFactory.TIMES, 13);

    PdfPTable table = new PdfPTable(2);
    PdfPCell cell;// w ww . j av a  2  s . c o  m
    Phrase phrase;

    phrase = new Phrase("Reservation by " + personName);
    phrase.setFont(title);
    cell = new PdfPCell(phrase);
    cell.setColspan(2);
    cell.setBorder(0);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorderWidthTop(1);
    cell.setBorderWidthLeft(1);
    cell.setBorderWidthRight(1);
    cell.setPadding(padding);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    phrase = new Phrase("Date: ");
    phrase.setFont(header);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthLeft(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase(BookingRoomUtils.getDate(startTime));
    phrase.setFont(value);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthRight(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase("Start: ");
    phrase.setFont(header);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthLeft(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase(BookingRoomUtils.getHoursAndMinutes(startTime));
    phrase.setFont(value);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthRight(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase("End: ");
    phrase.setFont(header);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthLeft(1);
    cell.setBorderWidthBottom(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase(BookingRoomUtils.getHoursAndMinutes(endTime));
    phrase.setFont(value);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthRight(1);
    cell.setBorderWidthBottom(1);
    cell.setPadding(padding);
    table.addCell(cell);

    table.setSpacingBefore(10);
    table.setSpacingAfter(10);

    return table;
}