1 つの段落を含む 1 ページの PDF を作成したいのですが、reportlab を使用して水平方向と垂直方向の両方に集中させます。以下の段落に適用された TA_CENTER 配置は、テキストを水平方向に配置しているように見えますが、ドキュメントの中央に配置していません。
style = getSampleStyleSheet()
normal = style["Normal"]
normal.alignment = TA_CENTER
normal.fontName = "Helvetica"
normal.fontSize = 15
normal.leading = 15
text = "Please be wrapped, centered horizontally and vertically!!"
pdf = SimpleDocTemplate(documentPath, pagesize = (250, 80), rightMargin=10, leftMargin=10, topMargin=5,bottomMargin=5)
story = []
para = Paragraph(text, normal)
story.append(para)
pdf.build(story)