Paragraph iTextPdf line spacing

Asked

Viewed 1,784 times

1

I’m using a very large text and adding directly in iTextPDF’s Paragraph, but the space between the lines is very large, I wanted to control the spacing between the lines, but I can’t make any changes, I tried in Font, Chuck and Paragraph, but without success...

Follow the example of what happens and what I want...

Happens:

  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto 



  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto



  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto 



  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

What I want:

  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto 
  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto 
  Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

Follow my little code (Data is already added)...

            //Código...

            Font f3 = new Font(Font.FontFamily.TIMES_ROMAN, 8f, Font.NORMAL);
            f3.getCalculatedLeading(1f);
            f3.setSize(5f);
            paragraph.setFont(f3);
            paragraph.setIndentationLeft(9.5f);//Movimenta horizontal
            paragraph.setLeading(40f);//Movimenta vertical
            paragraph.setFirstLineIndent(20f);

            //Código...
  • 1

    setLeading() determines line spacing. Typographically 1.25 font size gives a nice result.

  • I’m using "setLeading" to move vertically, now that I realize this method is to control the spacing of lines, as I do to move freely a Paragraph vertically???

  • 1

    In that case it is necessary to Paragraph within a table.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.