Align Paragraph at the center of the page

后端 未结 7 1356
执笔经年
执笔经年 2021-01-03 21:03

I am using itext to generate pdf file. I want to align my title in the middle of the page. Presently i am using like this

Paragraph preface = new Paragraph()         


        
相关标签:
7条回答
  • 2021-01-03 21:40

    Use Paragraph#setAlignment(int) :

    Paragraph preface = new Paragraph(); 
    preface.setAlignment(Element.ALIGN_CENTER);
    

    See the ALIGN_* constants in the Element interface for more possible values.

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