Align Paragraph at the center of the page

后端 未结 7 1502
执笔经年
执笔经年 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:36

    This is what worked for me (itext 5.0.5 ):

    Paragraph p3= new Paragraph("Hello" );
      p3.setAlignment(Element.ALIGN_CENTER);
    

提交回复
热议问题