[reportlab-users] SVG support on the Canvas?

Roberto Alsina ralsina at netmanagers.com.ar
Tue Jun 2 17:56:13 EDT 2009


On Tuesday 02 June 2009 18:19:16 Bill Janssen wrote:

> Tim Roberts <timr at probo.com> wrote:

> > Bill Janssen wrote:

> > > Found it.

> > > http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753

> > >

> > > If I understand what you're doing, you're converting the SVG to PDF,

> > > then pasting that PDF inline in the document that ReportLab is

> > > generating.

> >

> > Right. That's what you HAVE to do. The Acrobat readers don't

> > understand embedded SVG (yet).

>

> Sure, but there's an intermediate stage, an SVG interpreter as part of

> ReportLab that walks the parsed SVG and re-expresses it in terms of RL

> vector drawing calls, which of course then get turned into PDF. The

> problem with embedding "raw" PDF is that it doesn't always work.


BTW: the latest version is here:

http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/svgimage.py
http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/uniconvsaver.py

The svgimage flowable loads the SVG, which uniconvertor stores in its internal
representation.

Then the call to save() in drawOn() passes the canvas to the PDFDevice class,
which means it just draws the SVG in that canvas, there is never any PDF
generated until you save your document.

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)
"Our opponent is an alien starship packed with atomic bombs, I said.
We have a protractor. Okay, I’ll go home and see if I can scrounge up a
ruler and a piece of string." — Neal Stephenson


More information about the reportlab-users mailing list