{filelink=10372}
/***** Code de MesExemples.com *******/
/**
* @(#)PlusieursChunkPDF.java
*
*
* @author
*sakoba(java.mesexemples.com) @version 1.00 2013/4/26
*/
import com.itextpdf.text.BaseColor;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfWriter;
public class PlusieursChunkPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document,
new FileOutputStream("c:/PlusieursChunkPDF.pdf"));
document.open();
Chunk chunk = new Chunk("Premier text");
float subscript = -8.0f;
chunk.setTextRise(subscript);
chunk.setUnderline(new
BaseColor(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f,
PdfContentByte.LINE_CAP_ROUND);
document.add(chunk);
Chunk chunk1 = new Chunk("deuxième text");
document.add(chunk1);
Chunk chunk3;
chunk3 = new Chunk("Exemple d'un texte multiligne");
chunk3.setUnderline(new BaseColor(0xFF, 0x00, 0x00), 0.0f, 0.3f, 0.0f,
0.4f,
PdfContentByte.LINE_CAP_ROUND);
chunk3.setUnderline(new BaseColor(0x00, 0xFF, 0x00), 3.0f, 0.0f, 0.0f,
-0.5f,
PdfContentByte.LINE_CAP_PROJECTING_SQUARE);
chunk3.setUnderline(new BaseColor(0x00, 0x00, 0xFF), 0.0f, 0.2f, 15.0f,
0.0f,
PdfContentByte.LINE_CAP_BUTT);
document.add(chunk3);
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}