[reportlab-users] Flowables, documentation

Michael Hearne mhearne at usgs.gov
Thu Nov 29 13:13:59 EST 2007


I wanted to elaborate on the first issue I raised in my email:

1) I'm trying to create Image flowables in a report. However, the
image gets rendered smaller than the width and height I specified.
When I draw a frame around the Image, the frame is the size I wanted
for the Image. Is there a way to make a Flowable take up _all_ of
the space I specify?

Here's a code example that demonstrates the issue. When you run
this, the logo is surrounded by a bunch of white space. Why?
-------------------------------------------
#!/usr/bin/python

from reportlab.platypus import Frame, KeepInFrame, Image
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import letter
from urllib import urlretrieve

canvas = Canvas('output.pdf', pagesize=letter)
width,height = letter

flowables = []

w = 100
h = 40
filename = 'logo.jpg'
url = 'http://earthquake.usgs.gov/template/images/
header_graphic_usgsIdentifier_white.jpg'
urlretrieve(url,filename)
x = 20
y = 20

flowables.append(KeepInFrame(w,h,[Image(filename,w,h)]))
f = Frame(x,y,w,h)
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/2a3d26f0/attachment.html>


More information about the reportlab-users mailing list