How to align a paragraph (justify) using Itext?

I have 2 lines and I want to align them (justify).

I have this code:

Paragraph p=new Paragraph(ANC,fontFootData); p.setLeading(1, 1); p.setAlignment(Element.ALIGN_JUSTIFIED); document.add(p); Paragraph p2=new Paragraph(RUTTEL,fontFootData); p2.setLeading(1, 1); p2.setAlignment(Element.ALIGN_JUSTIFIED); document.add(p2); 

where ANC and RUTTEL are strings, but they are not aligned.

Can someone help me?

+6
source share
1 answer

For one line use ALIGN_JUSTIFIED_ALL, more than one line use ALIGN_JUSTIFIED.

+3
source

Source: https://habr.com/ru/post/948163/


All Articles