How to adjust spacing between paragraphs in iText7

后端 未结 2 812
情话喂你
情话喂你 2020-12-21 05:18

In iText7 I need to create 5 lines of text at the top of a document that are centered to the page. The easiest way I found to do this is:

doc.add(new Paragra         


        
相关标签:
2条回答
  • 2020-12-21 06:02

    Paragraph has 2 methods for handling what is known as the leading.

    Paragraph o1 = new Paragraph("");
    o1.setMultipliedLeading(1.0f);
    

    Multiplied leading is when you specify a factor of how big the leading will be compared to the height of the font.

    You can also set it document wise:

    document.setProperty(Property.LEADING, new Leading(Leading.MULTIPLIED, 1.2f));
    
    0 讨论(0)
  • 2020-12-21 06:15

    In my case with iText7, I used SetMarginTop(0f) and SetMarginBottom(0f) to make it.

    0 讨论(0)
提交回复
热议问题