[reportlab-users] vertical alignment for xpreformatted
Michael Hearne
mhearne at usgs.gov
Thu Nov 29 17:05:37 EST 2007
Is there some sort of vertical alignment attribute or method for
frames or xpreformatted instances? I'm trying to get some text to
use up all of the space in a frame and it keeps getting squished
towards the middle, as the code snippet below hopefully
demonstrates. I did look at the documentation and searched the for
examples, but they all seemed to relate to troubles with tables.
#!/usr/bin/python
from reportlab.platypus import Frame, KeepInFrame, Image
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph, XPreformatted, Image
canvas = Canvas('output.pdf', pagesize=letter)
width,height = letter
flowables = []
w = 100
h = 40
x = 20
y = 20
stylesheet = getSampleStyleSheet()
style = stylesheet['Normal']
text = '<para alignment="right"> <font size="32">\n'
text = text + "<b>Hello world!\nI'm right here</b>\n\n"
text = text + '</font></para>'
print text
p = XPreformatted(text,style,dedent=0)
flowables.append(KeepInFrame(w,h,[p]))
f = Frame(x,y,w,h,0,0,0,0)
f.drawBoundary(canvas)
f.addFromList(flowables,canvas)
canvas.save()
------------------------------------------------------
Michael Hearne
mhearne at usgs.gov
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20071129/d22660af/attachment.htm>
More information about the reportlab-users
mailing list