データベースから動的に取得され、ユーザーに提供される前にPDFに配置されるテキストのブロックがあります。テキストは、メモ帳の紙のように、裏打ちされた背景に配置されています。各背景行の間に1行のテキストだけが入るように、テキストの間隔を空けたいと思います。
次のコードを使用して、段落間に垂直方向の間隔を作成することができました(PDFの別の部分を生成するために使用されます)。
style = getSampleStyleSheet()['Normal']
style.fontName = 'Helvetica'
style.spaceAfter = 15
style.alignment = TA_JUSTIFY
story = [Paragraph(choice.value,style) for choice in chain(context['question1'].itervalues(),context['question2'].itervalues())]
generated_file = StringIO()
frame1 = Frame(50,100,245,240, showBoundary=0)
frame2 = Frame(320,100,245,240, showBoundary=0)
page_template = PageTemplate(frames=[frame1,frame2])
doc = BaseDocTemplate(generated_file,pageTemplates=[page_template])
doc.build(story)
ただし、段落が1つしかないため、ここでは機能しません。