Add a Paragraph to a document : Paragraph « PDF « Java Tutorial






import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class CreateParagraph {

  public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("HelloWorld.pdf"));
    document.open();
    document.add(new Paragraph("Hello World"));
    document.close();
  }
}








29.20.Paragraph
29.20.1.Add a Paragraph to a document
29.20.2.Paragraph Alignment: ALIGN_JUSTIFIED
29.20.3.Paragraph Alignment: Element.ALIGN_RIGHT
29.20.4.Element.ALIGN_JUSTIFIED
29.20.5.Paragraph Spacing Before
29.20.6.Paragraph Indentation Left
29.20.7.Paragraph Indentation Right
29.20.8.Paragraph Spacing After
29.20.9.Paragraph text
29.20.10.Paragraph Positions
29.20.11.Colored Paragraphs