[reportlab-users] Where is my canvas ? :)

Nicholas Wieland nicholas_wieland at yahoo.it
Mon Aug 1 05:35:45 EDT 2005


from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame, Paragraph
from reportlab.rl_config import defaultPageSize
from reportlab.graphics.shapes import Rect
from reportlab.lib.colors import green

page_width = defaultPageSize [0]
page_height = defaultPageSize [1]
hf = Frame (0, page_height - 200, page_width, 200)
ff = Frame (0, 0, page_width, page_height - 200)
r = Rect (0, page_height - 200, page_width, 200, fillColor = green)
r.fillColor = green
hf.addFromList ([r])
pt = PageTemplate (frames = [hf, ff])
doc = BaseDocTemplate (filename = "foo.pdf", PageTemplates = [pt])
doc.build ()
 
 
Obviously this doesn't work since I don't pass the canvas as an argument to frame.addFromList.
I know where to find canvas and how to use it, I'm just experimenting with Platypus, so I'd like to use everything at a high level, to simplify things a bit.
My question is: do I have to instantiate a canvas to make my script work ? From what I understood (nothing, maybe :p) the BaseDocTemplate class should pass a canvas to PageTemplate and so on.
 
TIA,
  ngw

		
---------------------------------
Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20050801/5c988780/attachment.html


More information about the reportlab-users mailing list