[reportlab-users] save to image file?

Carl Karsten carl at personnelware.com
Wed Nov 14 08:22:03 EST 2007


Andy Robinson wrote:

> 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.


Shucks. I want to generate a preview of a PyCon attendee badge when an attendee
registers.

I see 2 choices:

1. pipe the pdf output through something like convert (I think there are python
bindings)
carl at dell29:~$ convert carlresume07.pdf x.png

2. Give the user a pdf.

If pdf's would display nicely in a web page like an image, the 2 would be fine.
I just hate the current state of browser support, with the dialogs, tabs, etc.

Thanks,
Carl K

ps, did you pass on my Talk request message?




More information about the reportlab-users mailing list