Using Cairo to generate SVG in Django
Posted by stu at February 3rd, 2010
Cairo is a 2D vector graphics api used by Firefox, Gtk and other desktop projects.
I’m going to show here that it can also be used to generate web content, using Django.
I’m going to port two examples from the Michael Urmans Cairo Tutorial for PyGTK Programmers.
To understand the cairo and it’s drawing model I’d recommend his his Cairo Tutorial for Python Programmers.
Note: In this example I’ll be generating SVGs… as I.E. (as of 2010) does not support them, you might want to generate PNG or PDF – if you need to do this with cairo, look for one of the many cairo tutorials on the web.
The example django project can be downloaded at the end of the article.

