Add List in PDF using iText

iText supports various ways in which list can be displayed in a PDF. The List can be a simple list, numbered, list with symbols, no symbols list and many more. Lets see examples on how to add List in PDF using iText.

Important class – com.itextpdf.text.List

Below are few useful methods of the List class
a) setIndentationLeft(float indentation) Sets the indentation of this paragraph on the left side.

b) setIndentationRight(float indentation) Sets the indentation of this paragraph on the right side.

c) setNumbered(boolean numbered) Sets numbering to the list

d) setLettered(boolean lettered) Starts the list elements with letters- a,b,c etc

e) setListSymbol(String symbol) Sets the symbol of the list elements. Default is - . If you wish not to have a symbol then use blank.

Example

The example below illustrates use of most of the above methods.

Output
Add List in PDF using iText

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn