Java/PDF RTF/Chunk Size
Версия от 18:01, 31 мая 2010; (обсуждение)
Chunk Width
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class ChunkWidthPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream("ChunkWidthPDF.pdf"));
document.open();
Chunk c = new Chunk("Text Text Text Text Text Text Text Text Text Text");
float w = c.getWidthPoint();
System.out.println("The width of the chunk: is "+String.valueOf(w)+" points or "+w / 72f+" inches.");
document.add(c);
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}