我正在为处理垂直对齐的 ColumnText 编写一个小包装器 - 即。在边界框中顶部/中间/底部对齐。
当我打电话时SetSimpleColumn
,它需要边界框的位置。调用Go(True)
(true = test mode) 允许我测试文本的高度。从那里,我想重新分配 Y 坐标,因此当我调用Go()
. 如果可能,它是如何完成的?
编辑:示例:
Imports iTextSharp.text
...
columnText = New pdf.ColumnText(pageContentByte)
columnText.SetSimpleColumn(New Phrase("some text"), x1, y1, x2, y2, leading)
columnText.Go(True) ' Test mode.'
y1 = y2 + (y1 - columnText.yLine) ' Bottom-align it.'
''
' HOWTO: Re-position Y-coordinate (y1) of columnText object?'
''
columnText.Go() ' Render at adjusted Y position.'
(在注释末尾添加单引号以使语法突出显示正常工作)