Reputation: 33
My canvas initialization looks like:
canvas = canvas.Canvas(save_name, pagesize=(4032, 3024), bottomup=1)
#canvas.setFont('Helvetica', 12) #set font size and type (not working)
canvas.setFontSize(10000000) #set pt size (not working)
And my drawstring looks like:
canvas.drawString(100, y, line)
where y
is a variable and line
is a string.
No matter what I set either the setFontSize()
argument to or the second argument in setFont()
, the size of the font does not change in the PDF.
System: Debian (stretch), Python 3.5.3, Reportlab 3.5.8
EDIT:
Here's that MCVE
canvas = canvas.Canvas(save_name, pagesize=(4032, 3024), bottomup=1)
canvas.setFont("Times-Roman", 20)
text = "foo bar"
canvas.drawString(100, 3000, text)
canvas.save()
Upvotes: 1
Views: 2142
Reputation: 33
Solved. Not sure why, but placing the setFont()
method right before the drawString()
method fixed it.
Upvotes: 1