[reportlab-users] How hard would this be?

Robin Becker robin at reportlab.com
Wed Jan 31 17:17:14 EST 2007


Michael Hipp wrote:

> How hard would it be to take the "high level" features of Reportlab (e.g.

> Flowables, Tables, canvas) and replace the low level drawing primitives with

> something else?

>

> Specifically, I love the power, quality of output, and ease of use of

> Reportlab. But the fact that it produces PDFs is both it's best and worst

> feature (too too hard to print; too dependent on a fat pretentious app like

> Adobe Reader, necessity to save them as files rather than work in-memory,

> etc.). I'm thinking of replacing the "bottom layer" part that draws on a pdf

> with the print framework from wxPython* that draws on a print device context.

> wxPython has a powerful print framework, but compared to Reportlab it's a lot

> like using Assembly language.)

>

> So how hard would it be to insert a different layer underneath Reportlab?

>

> Thanks,

> Michael

.......
well we implemented the primitives for ps/eps/svg/pixmap in the graphics
framework, but that doesn't require all of the pdf canvas primitives and
is in fact so different as to make things quite hard.

In our proprietary code base we do have a bunch of adapters which allow
Paragraphs & Tables etc to be drawn on to single page ps/eps/pixmap
canvases. That's not the same as having a proper document object, but it
gets us quite a lot of the way. It's also probably the wrong approach if
you just want to make a canvas level as close as possible to the PDF one.

Even though the graphics renderers were supposed to be identical
externally (wow Arsenal just scored another goal; hooray) subtle
differences have crept in in the internals and the adapter code contains
translation maps like

__TRANS = {
'strokeLineCap': '_lineCap',
'strokeLineJoin': '_lineJoin',
'fontSize': '_fontSize',
'strokeWidth': '_lineWidth',
'fillColor': '_fillColor',
'strokeColor': '_strokeColor',
}

to get stuff to work.

--
Robin Becker


More information about the reportlab-users mailing list