Align Paragraph at the center of the page

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

    Not sure if this is an old version, but for PdfWriter these methods weren't there. Instead I used:

    Paragraph p = new Paragraph("This too shall pass");
    p.Alignment = Element.ALIGN_CENTER;
    

提交回复
热议问题