import java.awt.Color;
import java.io.FileOutputStream;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
float textrise = 6.0f;
Chunk c;
for (String s : "this is a test".split(" ")) {
c = new Chunk(s);
c.setTextRise(textrise);
c.setUnderline(new Color(0xC0, 0xC0, 0xC0), 0.2f, 0.0f, 0.0f, 0.0f,
PdfContentByte.LINE_CAP_BUTT);
document.add(c);
textrise -= 2.0f;
}
document.close();
}
}