带ReportLab的旋转文档(垂直文本)

2024-05-23 13:57:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图得到类似于以下片段的东西来实际绘制这个旋转90度的文档。页面大小已经是我想要的那样了,但是文本仍然是水平的。如何旋转文本使其垂直?

style = getSampleStyleSheet()
normal = style["Normal"]
normal.alignment = TA_CENTER
normal.fontName = "Helvetica"
normal.fontSize = 15

pdf = SimpleDocTemplate("testplatypus.pdf", pagesize = (80, 250), rightMargin=10, leftMargin=10, topMargin=20,bottomMargin=20)
story = []
text = "I really need this to be wrapped and vertical!"

para = Paragraph(text, normal)
story.append(para)
pdf.build(story)

Tags: text文档文本pdfstyle水平绘制页面