[reportlab-users] Canvas to SVG converter would be cool.

Andy Robinson reportlab-users@reportlab.com
Fri, 27 Sep 2002 21:45:48 +0100

As everyone knows by now, we 'cut the cake'
a bit differently a while back.  The pdfgen canvas
makes PDF, and our cross-platform efforts focussed
purely on Drawings.

There is  fundamental probem here that Dinu and I
know well, as we went through the PIDDLE project
and others.  PDF, SVG, Postscript and other 'high end' 
formats like our libart renderer or Java2d have a lot of
general concepts in common.  But they also have just 
enough semantic differences to make it hard.  For example:  

1. There's the problem of top-down and bottom-up 
   coordinates.  You cannot just 'invert' as you need 
   to flip the text upside down. I suspect one can
   write a generalized inversion routine to work 
   any stack of nested objects, but we have not done 
   it yet independent of any renderer.

2. Text and font models differ, and some environments
   like SVG need to be fuzzy about fonts. So you always
   need some 'confguration layer' to map fonts to your
   system or platform and it's impossible to guarantee 
   identical text metrics.  And PDF has dozens of
   operators to efficiently draw lines of text in
   various ways, saving us from having to work out
   the position of every glyph ourselves

3. There are clear differences between drawing 
   primitives.  SVG, PDF and Postscript all have
   different ideas about how to fill and stroke 
   unclosed curves; some use 3-point bezier curves
   and some use 4; and so on.

This means making choices up front about tradeoffs.
We decided to focus 100% on the PDF model.  So,
any other renderer will have a lot of work to do,
Going from "most PDF files" to an SVG preview
is fine, but handling ALL features would be much 
harder.  And if we tried to make some 'union of all' 
model in the centre, then we'd be a lot slower at
making PDF and not expose all its features.

There is this "version 2" type idea in my head,
that every graphics renderer has a flavour of
Canvas in it, and reportlab/graphics ceases to be 
a separate module, and you can make whole pages
in any output format - but there's a LOT of
hard research to do, and it would be a commercial
dead end unless you could get close to 100%