0
我試圖打印矩形,但我不知道該怎麼做,這段代碼工作正常,但我不知道如何追加矩形。Python ReportLab添加矩形
我會很感激任何幫助。
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)
謝謝!
我想你忘了矩形的繪製追加到故事變量 '故事= [畫]' –