Chunk Width : Chunk Size « PDF RTF « Java






Chunk Width

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();
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category