Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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. It also accesses around 200 flags from Wikipedia.org for test purposes (some of them hinting at more work to be done).

This release contains a fix for a missing import in the svglib library.

Features

  • 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
  • test on some standard W3C SVG tests available online
  • test on some Wikipedia sample SVG symbols available online
  • test on some Wikipedia sample SVG flags available online

Examples

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

>>> from svglib.svglib import svg2rlg
>>> from reportlab.graphics 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?
Release History

Release History

This version
History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
svglib_fix-0.0.4.tar.gz (541.8 kB) Copy SHA256 Checksum SHA256 Source Jun 29, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting