[reportlab-users] Flowables, again

Nicholas Wieland nicholas_wieland at yahoo.it
Tue Aug 2 04:30:56 EDT 2005


class CoverPage (Flowable):
  def __init__ (self, dossier_number):
    Flowable.__init__ (self)
    self.width = defaultPageSize [0]
    self.height = defaultPageSize [1]
    self.dossier_number = dossier_number
  def __repr__ (self):
    return "CoverPage (w=%s, h=%s, dn=%s)" % (self.width, self.height, self.dossier_number)
  def draw (self):
    image = Image.open (r"\Documents and Settings\engineering2\Desktop\report\images\copertina.jpg")
    self.canv.drawInlineImage (image, 0, 0, width = self.width, height = self.height)
    self.canv.setFillColorCMYK (0, 0, 0, 0)
    self.canv.drawString (100, self.height - 100, "Monte Paschi Asset Management SGR S.p.A.")
    self.canv.drawString (100, self.height -120, 'Numero Dossier: %s' % dossier_number)

if __name__ == '__main__':
  c = canvas.Canvas ("cover.py")
  f = Frame (0, 0, width = defaultPageSize [0], height = defaultPageSize [1])
  cp = CoverPage ("E2")
  f.addFromList ([cp], c)
  c.save ()
 
 
I really don't have a clue of why this doesn't work, I've just copied from XBox.
 
 
C:\Documents and Settings\foo\Desktop\report>\Python23\python.exe cover
.py
  File "cover.py", line 1
    %PDF-1.3
    ^
SyntaxError: invalid syntax
 
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/20050802/9c72a1d9/attachment.html


More information about the reportlab-users mailing list