I want to have a 1-page PDF file with one paragraph, but it is centralized both horizontally and vertically with reportlab. Aligning TA_CENTER when applied to the paragraph below seems to align the text horizontally, but does not center it in the center of the document.
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)
source share