Align Paragraph at the center of the page

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

    If you are looking for a solution to Itext7 then you can use the method setTextAlignment(...).

    Example:

    Paragraph preface = new Paragraph();
    // add text
    preface.setTextAlignment(TextAlignment.CENTER);
    

提交回复
热议问题