Java/PDF RTF/Chunk Size — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 09:00, 1 июня 2010
Chunk Width
<source lang="java">
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(); }
}
</source>