【发布时间】:2011-04-14 22:14:08
【问题描述】:
我正在使用ReportLab用python动态生成pdf。
我希望将一行文本放在页面的中心。这是我目前拥有的具体代码,但不知道如何将文本水平居中。
header = p.beginText(190, 740)
header.textOut("Title of Page Here")
# I know i can use TextLine etc in place of textOut
p.drawText(header)
文本显示,我可以手动移动左侧位置,使文本看起来居中,但我需要以编程方式将其居中,因为文本将是动态的,我不知道会有多少文本。
【问题讨论】:
标签: python pdf-generation reportlab