Skip to main content

An experimental library for reading and converting SVG.

Project description

Svglib is an experimental library for reading SVG files and converting them (to a reasonable degree) to other formats using the Open Source ReportLab Toolkit. As a package it reads existing SVG files and returns them converted to ReportLab Drawing objects that can be used in a variety of ReportLab-related contexts, e.g. as Platypus Flowable objects or in RML2PDF. As a command-line tool it converts SVG files into PDF ones. Tests include a vast amount of tests from the W3C SVG test suite.


  • convert SVG files into ReportLab Graphics Drawing objects

  • handle plain or compressed SVG files (.svg and .svgz)

  • allow patterns for output files on command-line

  • install a Python package named svglib

  • install a Python command-line script named svg2pdf

  • provide a Unittest test suite

  • access some standard W3C SVG tests available online

  • access some Wikipedia SVG samples available online


You can use svglib as a Python package e.g. like in the following interactive Python session:

>>> from svglib.svglib import svg2rlg
>>> from import renderPDF
>>> drawing = svg2rlg("file.svg")
>>> renderPDF.drawToFile(drawing, "file.pdf")

In addition a script named svg2pdf can be used more easily from the system command-line like this (you can see more examples when typing svg2pdf -h):

$ svg2pdf file1.svg file2.svgz
$ svg2pdf -o "%(basename)s.pdf" /path/file[12].svgz?

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svglib-0.6.0.tar.gz (559.6 kB view hashes)

Uploaded source

Built Distributions

svglib-0.6.0-py2.6.egg (27.4 kB view hashes)

Uploaded 2 6

svglib-0.6.0-py2.5.egg (27.5 kB view hashes)

Uploaded 2 5

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page