iTextSharp center align objects within the Document object

后端 未结 6 1853
面向向阳花
面向向阳花 2021-02-12 14:56

Is there a quick and simple way to center align objects within the Document object? Without performing any calculation logic, ie. Get width of page, get width

6条回答
  •  天命终不由人
    2021-02-12 15:33

    this iText (probably same for iTextSharp):

    paragraph.setAlignment( Element.ALIGN_CENTER );
    

    and you might want to set the indentation so that it sits nicely:

    paragraph.setIndentationLeft( 100 );
    paragraph.setIndentationRight( 100 );
    

提交回复
热议问题