[reportlab-users] save to image file?

Andy Robinson andy at reportlab.com
Wed Nov 14 04:02:22 EST 2007


On 14/11/2007, Carl Karsten <carl at personnelware.com> wrote:

> I just skimmed through a few of the reportlab doc pdfs. powerful stuff. But I

> didn't find what I was looking for: create a png/gif/jpg. Is there anything

> like that?

>

The graphics subframework can create charts and diagrams (but not
whole pages with paragraphs and tables) in those formats, as well as
within a PDF. There is a graphics guide tutorial and various runnable
tests in the graphics folder. Canonical use is...

d = Drawing(width, height)
d.add(shape1)
d.add(shape2)
d.save(formats=['gif','png','pdf'], fnRoot='mydrawing', outDir='myOutDir')

You need to install PIL, build the renderPM extension, and to install
14 standard fonts (or your own ones) which is covered in the docs.

Have fun,


--
Andy Robinson
CEO/Chief Architect
ReportLab Europe Ltd.
165 The Broadway, Wimbledon, London SW19 1NE, UK
Tel +44-20-8544-8049


More information about the reportlab-users mailing list