7

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?

1
  • 1
    How long are those strings? Maybe you're looking for ALIGN_JUSTIFIED_ALL instead of ALIGN_JUSTIFIED. In any case: alignment works for us, there's no reason it shouldn't work for you. Jun 27, 2013 at 11:13

2 Answers 2

4

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

1
  • 2
    just want to add api reference here itextsupport.com/apidocs/itext5/latest ALIGN_JUSTIFIED_ALL Does the same as ALIGN_JUSTIFIED but the last line is also spread out.
    – user1021364
    Nov 11, 2016 at 4:45
0

If you are using for C#, then:

p.Alignment = Element.ALIGN_JUSTIFIED;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.