danivare
danivare

Reputation: 101

How to align a paragraph (justify) whith Itext?

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

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 string, but they not be align.

Could anybody help me?

Upvotes: 8

Views: 15314

Answers (2)

Abi Chhetri
Abi Chhetri

Reputation: 1447

If you are using for C#, then:

p.Alignment = Element.ALIGN_JUSTIFIED;

Upvotes: 1

Osman Yilmaz
Osman Yilmaz

Reputation: 73

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

Upvotes: 5

Related Questions