[reportlab-users] Reportlab + SVG

556 views
Skip to first unread message

Richard Shea

unread,
Mar 31, 2014, 12:24:34 AM3/31/14
to reportl...@lists2.reportlab.com
It's a long time since I looked at this subject so I thought I would ask
for an update.

If I have an SVG file I wish to embed in a Reportlab generated PDF is
the recommended approach to use PIL (or Pillow ?) to convert it to a
non-vector format and use the result of the process to initialise a
Reportlab Image object ?

I'm asking because I thought sometime I read about a more direct
approach where ReportLab might deal with SVG's directly but now I go and
look for a reference to that idea I can't find it.




Thanks

Richard.



_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

Dinu Gherman

unread,
Mar 31, 2014, 2:09:02 AM3/31/14
to reportlab-users
Richard Shea:

> It's a long time since I looked at this subject so I thought I would ask
> for an update.
>
> If I have an SVG file I wish to embed in a Reportlab generated PDF is
> the recommended approach to use PIL (or Pillow ?) to convert it to a
> non-vector format and use the result of the process to initialise a
> Reportlab Image object ?
>
> I'm asking because I thought sometime I read about a more direct
> approach where ReportLab might deal with SVG's directly but now I go and
> look for a reference to that idea I can't find it.

You might want to look at this:

https://pypi.python.org/pypi/svglib/0.6.3

It's somewhat dusted, not Python 3.0, and comes with a few limitations, mostly given by SVG features not mappable to ReportLab Graphics features, like gradiation, some font magic and probably a few others...

Regards,

Dinu

Andy Robinson

unread,
Mar 31, 2014, 2:50:07 AM3/31/14
to reportlab-users
I can confirm that we have nothing other than Dinu's approach in the
open source world. It works very well though, handling the well-known
Postscript tiger image. If your image has a lot of text, it may make
sense to use a design package to convert your fonts to curves.

PIL does not handle these as proper vectors AFAIK.

ReportLab PLUS can handle PDF artwork natively so if you want to
consider the commercial route, you can turn SVG into PDF (using
various XPDF or Ghostscript tools) and just use them with all of our
image tags.

- Andy
--
Andy Robinson
Managing Director
ReportLab Europe Ltd.
Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK
Tel +44-20-8405-6420

Tamer Higazi

unread,
Mar 31, 2014, 4:58:57 AM3/31/14
to reportl...@lists2.reportlab.com
Hi Andy,

I am more and more interisted from day to day in reportlab... and I am
planing to write this week a flowable that implements SVG.

I found something:

http://ralsina.me/weblog/posts/BB753.html

and this might be really interisting:

http://sk1project.org/modules.php?name=Products&product=uniconvertor

which is in python as well. Totally open source and a part of inkmagic.


As soon I have finished the flowable it will be available on bitbucket.


Tamer



Am 31.03.2014 08:50, schrieb Andy Robinson:
> I can confirm that we have nothing other than Dinu's approach in the
> open source world. It works very well though, handling the well-known
> Postscript tiger image. If your image has a lot of text, it may make
> sense to use a design package to convert your fonts to curves.
>
> PIL does not handle these as proper vectors AFAIK.
>
> ReportLab PLUS can handle PDF artwork natively so if you want to
> consider the commercial route, you can turn SVG into PDF (using
> various XPDF or Ghostscript tools) and just use them with all of our
> image tags.

Tamer Higazi

unread,
Mar 31, 2014, 4:59:48 AM3/31/14
to reportl...@lists2.reportlab.com
Sorry, I ment "inkscape".....

Tamer

Am 31.03.2014 10:58, schrieb Tamer Higazi:
> Hi Andy,
>
> I am more and more interisted from day to day in reportlab... and I am
> planing to write this week a flowable that implements SVG.
>
> I found something:
>
> http://ralsina.me/weblog/posts/BB753.html
>
> and this might be really interisting:
>
> http://sk1project.org/modules.php?name=Products&product=uniconvertor
>
> which is in python as well. Totally open source and a part of inkmagic.
>
>
> As soon I have finished the flowable it will be available on bitbucket.
>
>
> Tamer
Reply all
Reply to author
Forward
0 new messages