Add paragraph in PDF using iText

To Add Paragraph in PDF using iText library is very easy. You can also set spacing between 2 paragraphs. Spacing can be added After/Before each of the paragraphs.

Important Class – com.itextpdf.text.Paragraph

For adding spacing we can use either
a) setSpacingBefore(float spacing)
b) setSpacingAfter(float spacing)

For Indentation either Right or left we can use
a) setIndentationLeft(float indentation)
b) setIndentationRight(float indentation)

Example

Lets see example on how to add paragraph in PDF using iText. We will have 2 paragraphs created and add a space between these paragraphs.

Output
Add paragraph in PDF using iText

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