不会在reportlab文本对象中设置字体

时间:2015-04-21 13:38:20

标签: python reportlab

我无法在reportlab中设置字体。我将画布和文本对象设置为Courier,大小为9,但是当我打开生成的文档时,文本都是Ariel,大小为12.我完全知道文本的空间以及它应该如何适应该字体和大小

for columns in [roadList_split[pos:pos+4] for pos in xrange(0, len(roadList_split), 4)]:
page = canvas.Canvas(os.path.join(out_path, r'IndexPage%s.pdf'%count), pagesize = letter)
page.setFont = ('Courier', 9)
text = page.beginText(.6875*inch, 10.5*inch)
text.setFont = ('Courier', 9)
for column in columns:
    text.textLines(column, trim = 0)
    text.moveCursor(1.875*inch,-10*inch)
page.drawText(text)
page.line(2.3681*inch, 0.5*inch, 2.3681*inch, 10.5*inch)
page.line(4.2431*inch, 0.5*inch, 4.2431*inch, 10.5*inch)
page.line(6.125*inch, 0.5*inch, 6.125*inch, 10.5*inch)
count += 1
page.save()

0 个答案:

没有答案