Example usage for com.lowagie.text Font BOLD

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

Introduction

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

Prototype

int BOLD

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

Click Source Link

Document

this is a possible style.

Usage

From source file:jm.web.Addons.java

License:GNU General Public License

public static void setPie(PdfWriter writer, Document document, String rep_pie) {
    try {//from w  ww . j  a va2  s  . c  o m
        PdfContentByte cb = writer.getDirectContent();
        /*cb.setLineWidth(2);
        cb.moveTo(60, document.bottomMargin()-5);
        cb.lineTo(document.right() - document.left()-70, document.bottomMargin()-5);
        */
        PdfPTable pie = new PdfPTable(1);
        pie.setTotalWidth(document.right() - document.left() - 120);
        pie.addCell(Addons.setCeldaPDF(rep_pie, Font.HELVETICA, 9, Font.BOLD, Element.ALIGN_CENTER, 0));
        pie.addCell(Addons.setCeldaPDF("Pg " + String.valueOf(writer.getPageNumber()), Font.HELVETICA, 9,
                Font.BOLD, Element.ALIGN_RIGHT, 0));
        pie.addCell(Addons.setCeldaPDF(
                "Reporte diseado por: Jorge Mueses Cevallos.      Mvil: 095204832     mail:jorge_mueses@yahoo.com",
                Font.HELVETICA, 5, Font.BOLD, Element.ALIGN_LEFT, 0));
        pie.writeSelectedRows(0, -1, 60, document.bottomMargin() - 10, cb);
    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPTable setCabeceraTabla(String[] titulo, float[] ancho) {
    PdfPTable encabezado = new PdfPTable(ancho);
    encabezado.setSpacingBefore(5f);/*from  w  w  w.j  a va  2 s .  co m*/
    for (int i = 0; i < titulo.length; i++) {
        encabezado.addCell(Addons.setCeldaPDF(titulo[i], Font.HELVETICA, 9, Font.BOLD, Element.ALIGN_CENTER, 1,
                Color.cyan)); /*  Color.CYAN  */
    }
    return encabezado;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPTable setCabeceraTablaBalance(String[] titulo, float[] ancho) {
    PdfPTable encabezado = new PdfPTable(ancho);
    encabezado.setSpacingBefore(5f);//w w w. j a  va2  s  .com
    encabezado.addCell(
            Addons.setCeldaPDF("", Font.HELVETICA, 9, Font.BOLD, Element.ALIGN_CENTER, 1, Color.cyan, 3, 3));
    encabezado.addCell(Addons.setCeldaPDF("SUMAS", Font.HELVETICA, 9, Font.BOLD, Element.ALIGN_CENTER, 1,
            Color.cyan, 3, 2));
    encabezado.addCell(Addons.setCeldaPDF("SALDOS", Font.HELVETICA, 9, Font.BOLD, Element.ALIGN_CENTER, 1,
            Color.cyan, 3, 2));
    for (int i = 0; i < titulo.length; i++) {
        encabezado.addCell(Addons.setCeldaPDF(titulo[i], Font.HELVETICA, 9, Font.BOLD, Element.ALIGN_CENTER, 1,
                Color.cyan)); /*  Color.CYAN  */
    }
    return encabezado;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPTable setCabeceraTabla(java.util.List titulo, float[] anchos, float ancho) {
    PdfPTable encabezado = new PdfPTable(anchos);
    encabezado.setWidthPercentage(ancho);
    encabezado.setSpacingBefore(5f);/*from w  ww .jav a  2s  .  c  o  m*/
    java.util.Iterator it = titulo.iterator();
    while (it.hasNext()) {
        encabezado.addCell(Addons.setCeldaPDF((String) it.next(), Font.HELVETICA, 8, Font.BOLD,
                Element.ALIGN_CENTER, 1, Color.cyan)); /*  Color.CYAN  */
    }
    return encabezado;
}

From source file:jmemorize.core.io.PdfRtfBuilder.java

License:Open Source License

private static void writeCategoryHeader(Document doc, Category category) throws DocumentException {
    Chunk chunk = new Chunk(category.getPath());
    chunk.setFont(new Font(Font.HELVETICA, 12, Font.BOLD));

    Paragraph paragraph = new Paragraph(chunk);
    paragraph.setSpacingBefore(1f);// ww  w  .  j a va2 s .com

    doc.add(paragraph);
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeTicketInfo(Document doc) throws Exception {
    Paragraph pg = new Paragraph("#" + tt.getUniqueId(), new Font(baseArial, 12, Font.BOLD));
    doc.add(pg);//w w  w .  j a v  a  2 s.  com

    PdfPTable tb = new PdfPTable(1);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(5.0f);

    PdfPCell cl = new PdfPCell(new Phrase(tt.getName(), new Font(baseArial, 10, Font.BOLD)));

    tb.addCell(cl);

    if (clientPerson != null) {
        cl = new PdfPCell(new Phrase(
                "Prane: " + clientPerson.getName() + " (Telefono Nr: " + clientPerson.getPhoneNo() + ")",
                new Font(baseArial, 10)));
        tb.addCell(cl);
    }

    cl = new PdfPCell(new Phrase("Uduoties informacija: ", new Font(baseArial, 10)));
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase(tt.getDescription(), new Font(baseArial, 10)));

    tb.addCell(cl);

    doc.add(tb);
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeJobInfo(Document doc) throws Exception {

    Paragraph pg = new Paragraph("\nUDUOTIES ATLIKIMO INFORMACIJA", new Font(baseArial, 10, Font.BOLD));
    doc.add(pg);/*www  .j a  va2s . co m*/

    PdfPTable tb = new PdfPTable(3);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(12.0f);
    tb.setWidths(new float[] { 6.0f, 84.0f, 10.0f });

    PdfPCell cl;

    doc.add(new Phrase("\nAtlikti darbai", new Font(baseArial, 12, Font.BOLD)));

    cl = new PdfPCell(new Phrase("Eil.nr", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);
    cl = new PdfPCell(new Phrase("Uduoties pavadinimas", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);
    cl = new PdfPCell(new Phrase("Valandos", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);

    doc.add(tb);

}

From source file:managedbean.afos.FlightDutyBacking.java

public void preProcessPDF(Object document) throws IOException, BadElementException, DocumentException {
    Document pdf = (Document) document;
    pdf.open();//from www.  ja  v  a 2  s  .  co  m
    pdf.setPageSize(PageSize.A4);
    ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext()
            .getContext();
    String logo = servletContext.getRealPath("") + File.separator + "resources" + File.separator + "images"
            + File.separator + "logo.png";
    Image logoImg = Image.getInstance(logo);
    logoImg.scalePercent(20f);
    SimpleDateFormat sdf = new SimpleDateFormat("E, dd/MM/yyyy 'at' hh:mm:ss a");

    Font titleFont = new Font();
    Font subtitleFont = new Font();
    titleFont.setSize(16);
    titleFont.setStyle(Font.BOLD);
    subtitleFont.setSize(12);
    subtitleFont.setStyle(Font.BOLD);

    Paragraph title = new Paragraph(flightReport.getType() + " Duty Report", titleFont);
    title.setAlignment(Element.ALIGN_CENTER);
    title.setSpacingAfter(12f);

    Paragraph subTitle1 = new Paragraph("Flight Information:", subtitleFont);
    subTitle1.setSpacingAfter(8f);

    Paragraph subTitle2 = new Paragraph(flightReport.getType() + " Checklist:", subtitleFont);
    subTitle2.setSpacingBefore(12f);
    subTitle2.setSpacingAfter(12f);

    com.lowagie.text.List list = new com.lowagie.text.List(true, 15);
    list.setLettered(true);
    list.add("Flight: " + selectedFlightSchedule.getFlight().getFlightNo());
    list.add("Return Flight: " + selectedFlightSchedule.getFlight().getReturnedFlight().getFlightNo());
    Airport departure, arrival;
    departure = selectedFlightSchedule.getLeg().getDepartAirport();
    arrival = selectedFlightSchedule.getLeg().getArrivalAirport();
    sdf.setTimeZone(TimeZone.getTimeZone(getTimeZone(departure)));
    list.add("Departure Time: " + sdf.format(selectedFlightSchedule.getDepartDate()) + " ("
            + departure.getCity().getCityName() + " Time)");
    sdf.setTimeZone(TimeZone.getTimeZone(getTimeZone(arrival)));
    list.add("Arrival Time: " + sdf.format(selectedFlightSchedule.getArrivalDate()) + " ("
            + arrival.getCity().getCityName() + " Time)");
    list.add("Origin: " + departure.getCity().getCityName() + " (" + departure.getAirportName() + ")");
    list.add("Destination: " + arrival.getCity().getCityName() + " (" + arrival.getAirportName() + ")");

    pdf.add(logoImg);
    pdf.add(new Paragraph(" "));
    pdf.add(title);
    pdf.add(subTitle1);
    pdf.add(list);
    pdf.add(subTitle2);
    pdf.setMargins(72, 72, 72, 72);
    pdf.addAuthor("Merlion Airline");
    pdf.addCreationDate();
    sdf.applyPattern("dd/MM/yyyy_hh:mm:ss");
    pdf.addTitle("Post-Flight Duty Report_" + selectedFlightSchedule.getFlight().getFlightNo() + "_"
            + sdf.format(selectedFlightSchedule.getDepartDate()));
}

From source file:mesquite.lib.MesquitePDFFile.java

License:Open Source License

/**
@arg s String holds the text that the pdf file will contain
@arg font java.awt.Font the font is specified this way for compatibility with the similar method in MesquitePrintJob
 *///from w w  w  . j a  va 2 s.c  o  m
public void printText(String s, java.awt.Font font) {
    final String exceptionMessage = "Error, an exception occurred while creating the pdf text document: ";
    if (s == null || font == null)
        return;

    //do the translation from logical to physical font here      
    //currently, the only font this method ever gets called with is "Monospaced",PLAIN,10.  So the
    //translation effort here will be minimal      
    int desiredFontFamily; // "Monospaced" isn't defined in com.lowagie.text.Font
    if (font.getFamily().equals("Monospaced"))
        desiredFontFamily = com.lowagie.text.Font.COURIER;
    else
        desiredFontFamily = com.lowagie.text.Font.TIMES_ROMAN;
    com.lowagie.text.Font textFont;
    switch (font.getStyle()) {
    case java.awt.Font.BOLD: {
        textFont = new com.lowagie.text.Font(desiredFontFamily, font.getSize(), com.lowagie.text.Font.BOLD);
        break;
    }
    case java.awt.Font.ITALIC: {
        textFont = new com.lowagie.text.Font(desiredFontFamily, font.getSize(), com.lowagie.text.Font.ITALIC);
        break;
    }
    case java.awt.Font.PLAIN: {
        textFont = new com.lowagie.text.Font(desiredFontFamily, font.getSize(), com.lowagie.text.Font.NORMAL);
        break;
    }
    default: {
        textFont = new com.lowagie.text.Font(desiredFontFamily, font.getSize(),
                com.lowagie.text.Font.BOLDITALIC);
    }
    }
    document = new Document();
    try {
        PdfWriter.getInstance(document, new FileOutputStream(pdfPathString));
        addMetaData(document);
        document.open();
        document.add(new Paragraph(s, textFont));
    } catch (DocumentException de) {
        MesquiteTrunk.mesquiteTrunk.alert(exceptionMessage + de.getMessage());
    } catch (IOException ioe) {
        MesquiteTrunk.mesquiteTrunk.alert(exceptionMessage + ioe.getMessage());
    }
    this.end();
}

From source file:mitm.common.pdf.MessagePDFBuilder.java

License:Open Source License

private Font createHeaderFont() {
    /*//  w w w  . j ava  2  s  .  c om
     * Font for the headers
     */
    Font headerFont = new Font();
    headerFont.setStyle(Font.BOLD);
    headerFont.setSize(headerFontSize);

    return headerFont;
}