Chunk Underline : Chunk « PDF « Java Tutorial

Home
Java Tutorial
1.Language
2.Data Type
3.Operators
4.Statement Control
5.Class Definition
6.Development
7.Reflection
8.Regular Expressions
9.Collections
10.Thread
11.File
12.Generics
13.I18N
14.Swing
15.Swing Event
16.2D Graphics
17.SWT
18.SWT 2D Graphics
19.Network
20.Database
21.Hibernate
22.JPA
23.JSP
24.JSTL
25.Servlet
26.Web Services SOA
27.EJB3
28.Spring
29.PDF
30.Email
31.J2ME
32.J2EE Application
33.XML
34.Design Pattern
35.Log
36.Security
37.Apache Common
38.Ant
39.JUnit
Java Tutorial » PDF » Chunk 
29.16.9.Chunk UnderlinePrevious/Next
import java.awt.Color;
import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class MainClass {
  public static void main(String[] argsthrows Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    Font font = new Font(Font.COURIER, 10, Font.BOLD);
    font.setColor(new Color(0xFF0xFF0xFF));
    Chunk fox = new Chunk("this is a ", font);
    Chunk jumps = new Chunk(" test "new Font());
    Chunk dog = new Chunk(" another "new Font(Font.TIMES_ROMAN, 14, Font.ITALIC));

    dog.setUnderline(new Color(0xFF0x000x00)3.0f0.0f, -5.0f 0.0f,
        PdfContentByte.LINE_CAP_ROUND);
    document.add(fox);
    document.add(jumps);
    document.add(dog);
    document.close();
  }
}
29.16.Chunk
29.16.1.PDF file with hyphenated text
29.16.2.Chunk with anchor
29.16.3.Chunk with action
29.16.4.Width of a chunk
29.16.5.Chunk.NEWLINE
29.16.6.Scale Chunk
29.16.7.Use TextRise of a chunk to create supscript and subscript
29.16.8.Background of a chunk
29.16.9.Chunk Underline
29.16.10.Chunk Text Render Mode: PdfContentByte.TEXT_RENDER_MODE_FILL
29.16.11.Chunk Text Render Mode: PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE
29.16.12.Chunk Text Render Mode: PdfContentByte.TEXT_RENDER_MODE_INVISIBLE
29.16.13.Chunk Text Render Mode:PdfContentByte.TEXT_RENDER_MODE_STROKE
29.16.14.Chunk in bold
29.16.15.Create chunk from string
29.16.16.Skew a chunk
29.16.17.Create Phase from chunk
29.16.18.Local Destination
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.