Example usage for com.itextpdf.text Font BOLD

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

Introduction

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

Prototype

int BOLD

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

Click Source Link

Document

this is a possible style.

Usage

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Chunk getChunkChapter(String text) {
    return new Chunk(text, FontFactory.getFont(fontNameStandard, fontSizeChapter, Font.BOLD));
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Chunk getChunkElement(String text) {
    return new Chunk(text, FontFactory.getFont(fontNameStandard, fontSizeElement, Font.BOLD));
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Chunk getChunkTextBold(String text) {
    return new Chunk(text, FontFactory.getFont(fontNameStandard, fontSizeText, Font.BOLD));
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Chunk getChunkTextBoldWithReference(String text, String reference) {
    Chunk chunkText = new Chunk(text, FontFactory.getFont(fontNameStandard, fontSizeText, Font.BOLD));
    // Referenz setzen
    chunkText.setLocalGoto(reference);/*from w  w w.  j  a v a  2  s . c  o m*/
    // Unterstreichen
    chunkText.setUnderline(new BaseColor(0x00, 0x0f, 0xFF), 0.5f, 0.0f, -4f, 0.0f,
            PdfContentByte.LINE_CAP_BUTT);
    return chunkText;
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Phrase getPhraseTextBold(String text) {
    return new Phrase(text, FontFactory.getFont(fontNameStandard, fontSizeText, Font.BOLD));
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Phrase getPhraseChapter(String text) {
    return new Phrase(text, FontFactory.getFont(fontNameStandard, fontSizeChapter, Font.BOLD));
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Paragraph getParagraphChapter(String text) {
    return new Paragraph(text, FontFactory.getFont(fontNameStandard, fontSizeChapter, Font.BOLD));
}

From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java

License:Apache License

private Paragraph getParagraphTextBold(String text) {
    return new Paragraph(text, FontFactory.getFont(fontNameStandard, fontSizeText, Font.BOLD));
}

From source file:de.knurt.heinzelmann.util.itext.TextBlock.java

License:Creative Commons License

private List<Chunk> getChunks(String content) {
    Font italic = new Font(this.font);
    italic.setStyle(Font.ITALIC);
    Font normal = new Font(this.font);
    normal.setStyle(Font.NORMAL);
    Font bold = new Font(this.font);
    bold.setStyle(Font.BOLD);
    Font bolditalic = new Font(this.font);
    bolditalic.setStyle(Font.BOLDITALIC);
    Font markfont = null;//  www  .j a  v a  2  s .  c o m
    boolean markModus = false;

    List<Chunk> result = new ArrayList<Chunk>();
    List<Chunk> tmp = new ArrayList<Chunk>();

    StringTokenizer tokenizer = new StringTokenizer(content, "\\*", true);
    while (tokenizer.hasMoreTokens()) {
        String tok = tokenizer.nextToken();
        if (tok.equals("*")) {
            if (markModus) {
                if (markfont.getStyle() == Font.ITALIC) {
                    markfont = bold;
                } else {
                    markfont = bolditalic;
                }
            } else {
                if (markfont == null) {
                    markfont = italic;
                    markModus = true;
                } else if (markfont.getStyle() == Font.BOLDITALIC) {
                    markfont = bold;
                } else if (markfont.getStyle() == Font.BOLD) {
                    markfont = italic;
                } else if (markfont.getStyle() == Font.ITALIC) {
                    markfont = null;
                }
            }
            continue;
        }
        if (markfont != null) {
            tmp.add(new Chunk(tok, markfont));
            markModus = false;
        } else {
            tmp.add(new Chunk(tok, normal));
        }
    }
    result.addAll(tmp);
    return result;
}

From source file:de.tuttas.servlets.DokuServlet.java

private Document createUmfrageauswertung(List<UmfrageResult> res1, List<UmfrageResult> res2, int idUmfrage1,
        int idUmfrage2, String filter1, String filter2, String kopf, OutputStream out)
        throws DocumentException, BadElementException, IOException {
    Document document = new Document();
    /* Basic PDF Creation inside servlet */
    Umfrage u1 = em.find(Umfrage.class, idUmfrage1);
    Umfrage u2 = em.find(Umfrage.class, idUmfrage2);

    // Bild einfgen
    String url = "http://www.mmbbs.de/fileadmin/template/mmbbs/gfx/mmbbs_logo_druck.gif";
    Image image = Image.getInstance(url);
    image.setAbsolutePosition(45f, 720f);
    image.scalePercent(50f);/*  w w  w .  j a  va 2  s  .  c om*/

    StringBuilder htmlString = new StringBuilder();
    htmlString.append(kopf);
    htmlString.append("<br></br>");

    int maxRows = res1.size();
    if (res2.size() > maxRows) {
        maxRows = res2.size();
    }
    PdfWriter writer = PdfWriter.getInstance(document, out);
    document.open();
    writer.setPageEmpty(false);
    Font boldFont = new Font(Font.FontFamily.HELVETICA, 18, Font.BOLD);
    Font normalFont = new Font(Font.FontFamily.HELVETICA, 10, Font.ITALIC);
    PdfPTable table = new PdfPTable(new float[] { 1, 2, 2 });
    PdfPCell qestionCell;
    PdfPCell group1Cell;
    PdfPCell group2Cell;
    int i = 0;
    for (i = 0; i < maxRows; i++) {
        Log.d("Print Row " + i);
        if (i % 5 == 0) {
            if (i != 0) {
                document.add(table);
                document.newPage();
                document = printHead(writer, document, htmlString, out, image);
            } else {
                document = printHead(writer, document, htmlString, out, image);
            }

            table = new PdfPTable(new float[] { 1, 2, 2 });
            table.setWidthPercentage((float) 100.0);
            qestionCell = new PdfPCell(new Phrase("\nFragen", boldFont));
            group1Cell = new PdfPCell();
            group1Cell.addElement(new Phrase("Hauptgruppe:", boldFont));
            group1Cell.addElement(new Phrase(u1.getNAME() + "\n" + filter1, normalFont));
            group2Cell = new PdfPCell();
            group2Cell.addElement(new Phrase("Vergleichsgruppe:", boldFont));
            group2Cell.addElement(new Phrase(u2.getNAME() + "\n" + filter2, normalFont));
            qestionCell.setBorderWidth(2.0f);
            group1Cell.setBorderWidth(2.0f);
            group2Cell.setBorderWidth(2.0f);
            table.addCell(qestionCell);
            table.addCell(group1Cell);
            table.addCell(group2Cell);
        }
        String url1 = UmfrageUtil.getCharUrl(res1.get(i));
        Log.d("URL1=" + url1);
        Image image1 = Image.getInstance(url1);

        Image image2 = null;
        if (res2.size() > i) {
            String url2 = UmfrageUtil.getCharUrl(res2.get(i));
            Log.d("URL2=" + url2);
            image2 = Image.getInstance(url2);
        }
        Log.d("Write to pdf:" + res1.get(i).getFrage());
        qestionCell = new PdfPCell(new Phrase(res1.get(i).getFrage(), normalFont));
        qestionCell.setBorderWidth(1.0f);
        group1Cell = new PdfPCell(image1, true);
        group1Cell.setBorderWidth(1.0f);
        group1Cell.setPadding(10);
        if (image2 != null)
            group2Cell = new PdfPCell(image2, true);
        else
            group2Cell = new PdfPCell();
        group2Cell.setBorderWidth(1.0f);
        group2Cell.setPadding(10);

        table.addCell(qestionCell);
        table.addCell(group1Cell);
        table.addCell(group2Cell);
    }
    if (!(i % 5 == 0)) {
        document.add(table);
    }

    document.close();
    return document;
}