iText basics



The default font in iText is Helvetica with size 12 pt.
Chunk:
This is the smallest significant part of text that can be added to a document

Phrase:
A Phrase is a series of Chunks. 

paragraph:
The Paragraph class is derived from the Phrase class.
If you had used a Paragraph instead of a Phrase it wouldn’t have been necessary to add a newline.
A Paragraph is a series of Chunks and/or Phrases.
A Paragraph has the same qualities of a Phrase, but also some additional layout-parameters:
- The indentation Eg. setFirstLineIndent(75), setIndentationLeft(50) and setIndentationRight(25)
- The alignment of the text Eg. paragraph.setAlignment(Element.ALIGN_RIGHT) 

Example:
Paragraph p = new Paragraph("This is a paragraph",
               FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));

No comments:

Post a Comment