Example usage for com.itextpdf.io.font FontConstants HELVETICA_BOLD

List of usage examples for com.itextpdf.io.font FontConstants HELVETICA_BOLD

Introduction

In this page you can find the example usage for com.itextpdf.io.font FontConstants HELVETICA_BOLD.

Prototype

String HELVETICA_BOLD

To view the source code for com.itextpdf.io.font FontConstants HELVETICA_BOLD.

Click Source Link

Document

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

Usage

From source file:cl.a2r.wsmicampov2.dao.TrasladoDAO.java

public static void addPageToGuia(Traslado traslado, List<String> listDiios, Document document,
        Integer cantAnimales) {/*from   w  w w.ja  v a 2 s.  co m*/

    try {

        Integer identificadorTraslado = traslado.getId();
        String fundoOrigen = traslado.getFundoOrigen();
        String fundoDestino = traslado.getFundoDestino();
        Date fecha = traslado.getFecha();
        String nombreChofer = traslado.getNombreChofer();
        String rutChofer = traslado.getRutChofer();
        String patenteCamion = traslado.getPatenteCamion();
        String patenteAcoplado = traslado.getAcopladoPatente();
        String nombreTransportista = traslado.getNombreTransportista();
        String rutTransportista = traslado.getRutTransportista();

        String imagePath = "/usr/share/MiCampoGuiasUpload/A2RLogo.png";
        //        String imagePath="Z:\\Chilterra\\MiCampoGuias\\A2RLogo.png";

        DateFormat df = new SimpleDateFormat("dd-MM-yyyy hh_mm_ss");
        DateFormat df2 = new SimpleDateFormat("dd-MM-yyyy");
        Date today = Calendar.getInstance().getTime();
        String reportDate = df.format(today);
        String reportDate2 = df2.format(today);

        PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);

        Text fechaText = new Text("Fecha: " + reportDate2).setTextAlignment(TextAlignment.RIGHT);
        Paragraph paragraphFecha = new Paragraph().add(fechaText);
        paragraphFecha.setTextAlignment(TextAlignment.RIGHT);
        document.add(paragraphFecha);

        Text title = new Text("TRASLADO INTERNO DE ANIMALES No. " + identificadorTraslado).setFont(bold);
        title.setFontSize(12);

        Image a2R = new Image(ImageDataFactory.create(imagePath));
        Paragraph p = new Paragraph("").add(a2R).add(title);

        document.add(p);

        //Datos del traslado
        Table table = new Table(2);

        table.addCell(CellHelper.getCell("Fundo origen: ", fundoOrigen, TextAlignment.LEFT));
        table.addCell(CellHelper.getCell("Fundo destino: ", fundoDestino, TextAlignment.LEFT));

        table.addCell(CellHelper.getCell("Nombre Chofer: ", nombreChofer, TextAlignment.LEFT));
        table.addCell(CellHelper.getCell("Rut Chofer: ", nombreChofer, TextAlignment.LEFT));

        table.addCell(CellHelper.getCell("Patente camin: ", patenteCamion, TextAlignment.LEFT));
        table.addCell(CellHelper.getCell("Patente acoplado: ", patenteAcoplado, TextAlignment.LEFT));

        table.addCell(CellHelper.getCell("Nombre transportista: ", nombreTransportista, TextAlignment.LEFT));
        table.addCell(CellHelper.getCell("Rut transportista: ", rutTransportista, TextAlignment.LEFT));

        document.add(table);

        Paragraph totalAnimales = CellHelper.getBoldParagraph("Cantidad total de animales: ",
                cantAnimales.toString());

        document.add(totalAnimales);

        //Observaciones
        Paragraph observaciones = new Paragraph("Observaciones: ").setBold();
        document.add(observaciones);

        Table observTable = new Table(1);
        observTable.addCell(CellHelper.getCellObservaciones("", TextAlignment.LEFT));
        document.add(observTable);

        Paragraph space1 = new Paragraph("");
        document.add(space1);

        Paragraph space2 = new Paragraph("");
        document.add(space2);

        Paragraph space3 = new Paragraph("");
        document.add(space3);

        Paragraph space4 = new Paragraph("");
        document.add(space4);

    } catch (Exception ex) {

    }

}

From source file:cl.a2r.wsmicampov2.dao.TrasladoDAO.java

public static void addDiiosPage(Document document, List<String> listDiios) {

    try {//  ww  w.j a v a 2s.  c  om

        Integer cantAnimales = listDiios.size();
        Integer diff = 0;

        if (listDiios.size() < 6) {
            diff = 6 - cantAnimales;
        } else {

            if (cantAnimales % 6 != 0) {

                Integer cociente = cantAnimales / 6;
                diff = ((cociente + 1) * 6) - cantAnimales;
            }

        }

        for (int i = 0; i < diff; i++) {
            listDiios.add(" ");
        }

        PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);
        Text subTitle = new Text("Diios: ").setFont(bold);
        Paragraph subtitleParagraph = new Paragraph().add(subTitle);

        document.add(subtitleParagraph);
        Table tableDiios = new Table(6);
        for (int i = 0; i < listDiios.size(); i++) {

            tableDiios.addCell(CellHelper.getCellDiios(listDiios.get(i), TextAlignment.LEFT));
        }

        document.add(tableDiios);

    } catch (Exception ex) {

    }

}

From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java

public static Cell getCell(String text1, String text2, TextAlignment alignment) {

    try {/*from   w  w w  .j  ava 2s . co m*/
        PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);
        Text tx1 = new Text(text1).setFont(bold);

        Text tx2 = new Text(text2);
        Paragraph p = new Paragraph().add(tx1).add(tx2);

        Cell cell = new Cell().add(p);

        cell.setPadding(0);
        cell.setTextAlignment(alignment);
        cell.setBorder(Border.NO_BORDER);
        return cell;
    } catch (Exception ex) {

    }
    return null;

}

From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java

public static Paragraph getBoldParagraph(String text1, String text2) {
    try {// www.  j a v  a2 s . c  o m

        PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);
        Text tx1 = new Text(text1).setFont(bold);

        Text tx2 = new Text(text2);
        Paragraph p = new Paragraph().add(tx1).add(tx2);
        return p;

    } catch (Exception ex) {

    }
    return new Paragraph();
}

From source file:output.InvoicePDF.java

private Table clientInformation() throws IOException {
    float[] widths = { 1, 5, 1, 5 };
    Table table = new Table(widths);

    Cell cell;//from   ww  w  .ja v  a2s  . co  m

    cell = new Cell();
    cell.add("Client:");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add(this.clientName);
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Email:");
    cell.setBorder(Border.NO_BORDER);
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setPaddingLeft(50f);
    table.addCell(cell);

    cell = new Cell();
    cell.add(client.getClientEmail(client.clientID(clientName)));
    cell.setFontColor(Color.BLUE);
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Name:");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add(client.getClientName(client.clientID(clientName)));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Tel:");
    cell.setBorder(Border.NO_BORDER);
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setPaddingLeft(50f);
    table.addCell(cell);

    cell = new Cell();
    cell.add(client.getClientTel(client.clientID(clientName)));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Website:");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add(client.getClientURL(client.clientID(clientName)));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Webhost:");
    cell.setBorder(Border.NO_BORDER);
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setPaddingLeft(50f);
    table.addCell(cell);

    cell = new Cell();
    cell.add(client.getClientHost(client.clientID(clientName)));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Type:");
    cell.setBorder(Border.NO_BORDER);
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    table.addCell(cell);

    cell = new Cell();
    cell.add(client.getClientType(client.clientID(clientName)));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Date:");
    cell.setBorder(Border.NO_BORDER);
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setPaddingLeft(50f);
    table.addCell(cell);

    cell = new Cell();
    cell.add(DATE_FORMAT.format(new Date()));
    cell.setBorder(Border.NO_BORDER);
    table.addCell(cell);

    return table;
}

From source file:output.InvoicePDF.java

private Table quoteSection() throws IOException {
    Table table = new Table(new float[] { 2, 1, 1, 1, 5 });
    table.setWidthPercent(100f);//from  w  w  w .  j a va2s. c  om
    Cell cell;

    cell = new Cell();
    cell.add("Category");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setTextAlignment(TextAlignment.CENTER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Rate");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setTextAlignment(TextAlignment.CENTER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("per");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setTextAlignment(TextAlignment.CENTER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Rate Unit");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setTextAlignment(TextAlignment.CENTER);
    table.addCell(cell);

    cell = new Cell();
    cell.add("Short Description");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setTextAlignment(TextAlignment.CENTER);
    table.addCell(cell);

    List<Double> totals = new ArrayList<>();

    // Loop through table here
    ObservableList<InvoiceItems> invoiceItems = this.invoiceTableView.getItems();
    invoiceItems.forEach((item) -> {
        table.addCell(new Cell().add(new Paragraph(item.getCategory())));
        table.addCell(new Cell().add(new Paragraph(item.getCost())));
        table.addCell(new Cell().add(new Paragraph(item.getCostUnit())));
        table.addCell(new Cell().add(new Paragraph(item.getCostUnitTotal())));
        table.addCell(new Cell().add(new Paragraph(item.getShortDescription())));
        totals.add(Double.parseDouble(item.getCost()) * Double.parseDouble(item.getCostUnitTotal()));
    });

    Double total = 0.0;
    total = totals.stream().map((d) -> d).reduce(total, (accumulator, _item) -> accumulator + _item);

    cell = new Cell(1, 1);
    cell.add("Total");
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    table.addCell(cell);

    cell = new Cell(1, 4);
    cell.add(String.valueOf(total));
    cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD));
    cell.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    table.addCell(cell);

    return table;
}

From source file:wbs.jsf1.pdf.LottoReceiptBean0.java

public byte[] createPdfFrom(Lottoschein lottoschein) {
    try {/*from  w w w .  ja v a 2s.c o m*/
        zahlen = lottoschein;

        ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();
        PdfWriter writer = new PdfWriter(pdfStream);
        PdfDocument pdf = new PdfDocument(writer);
        PageSize pageSize = new PageSize(PageSize.A6);
        Document document = new Document(pdf, pageSize);
        document.setMargins(20, 20, 40, 20);
        PdfFont font = PdfFontFactory.createFont(FontConstants.HELVETICA);
        PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);
        // Header
        document.add(getHeaderTable());
        // Lottozahlen auflisten
        document.add(getZiehungsDatenTable(font, bold));
        // Losnummer
        document.add(getLosnummerTable(font, bold));
        // Spieltage
        document.add(getSpieltageTable(font, bold));
        // Laufzeit
        document.add(getLaufzeitTable(font, bold));
        // Betrag
        document.add(getBetragTable(font, bold));
        document.close();
        LOG.log(Level.INFO, "PDF succesfully created.");
        return pdfStream.toByteArray();
    } catch (IOException ex) {
        Logger.getLogger(LottoReceiptBean0.class.getName()).log(Level.SEVERE, "pdf creation problem", ex);
    }
    return null;
}