[reportlab-users] Problem with renderPM.saveToFile; how to
output .PNG?
waxmop
reportlab-users@reportlab.com
Fri, 15 Aug 2003 09:59:34 -0400
Thanks for the help. If I've already created a Drawing object like this:
>>>from reportlab.graphics.shapes import *
>>>from reportlab.lib import colors
>>>d = Drawing(100,100)
>>>r = Rect(10, 10, 80, 80, fillColor='yellow')
>>>d.add(r)
How do I send that Drawing object to a file? I thought I would just
pass d to PMCanvas.saveToFile(...), but that didn't work.
On Thu, 14 Aug 2003 17:19:39 +0100
Robin Becker <robin@reportlab.com> wrote:
> In article <410-220038414122037242@M2W030.mail2web.com>, waxmop@gtcinternet.com
> <waxmop@gtcinternet.com> writes
> >>>You problably meant to use "drawToFile" instead.
> >
> >The graphics guide on page 4 says to use 'saveToFile' rather than
> >drawToFile with PNG output:
> >
> >If we wanted to generate the same drawing as a bitmap file for a website,
> >say, all we need to do is write code like this:
> >
> >from reportlab.graphics import renderPM
> >renderPM.saveToFile(d, 'example1.png', 'PNG')
> ....saveToFile is a method of the PMCanvas whilst drawToFile is a module level function.
>
>
> PythonWin 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on win32.
> Portions Copyright 1994-2001 Mark Hammond (mhammond@skippinet.com.au) -
> see 'Help/About PythonWin' for further copyright information.
> >>> from reportlab.graphics.renderPM import PMCanvas
> >>> c = PMCanvas(10,10)
> >>> c.saveToFile('/tmp/bongo.png','PNG')
> >>>
>
> --
> Robin Becker
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>