[英]Python ReportLab add rectangle
我正在嘗試打印矩形,但是我不知道該怎么做,此代碼可以正常工作,但我不知道如何附加矩形。
我將非常感謝您的幫助。
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.pagesizes import letter
from reportlab.platypus import Paragraph, SimpleDocTemplate, Flowable, Spacer
styles = getSampleStyleSheet()
draw = Drawing(500, 200)
draw.add(Rect(0, 100, 500, 100))
hola = ParagraphStyle('')
hola.fontSize = 9
hola.leading=0
story = []
#add some flowables
story.append(Paragraph("This is a ",hola))
story.append(Spacer(0,20))
story.append(Paragraph(" <i>Normal</i> style.",hola))
doc = SimpleDocTemplate('mydoc.pdf',pagesize = letter)
doc.build(story)
謝謝 !
您是否需要將抽獎添加到故事中: story.append(draw)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.