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.
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
access some standard W3C SVG tests available online
access some Wikipedia SVG samples 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?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file svglib-0.6.0.tar.gz
.
File metadata
- Download URL: svglib-0.6.0.tar.gz
- Upload date:
- Size: 559.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccd50d9e5d35b827a0f6b65903f6b45e279867af8933418cfaf7eeb293e08762 |
|
MD5 | dacd0271ab9014931f7d5d2d919c51c1 |
|
BLAKE2b-256 | eba005f50f460ab82b585cf1943cf6f61bc17d857ef7092d06990f5f63f885f9 |
Provenance
File details
Details for the file svglib-0.6.0-py2.6.egg
.
File metadata
- Download URL: svglib-0.6.0-py2.6.egg
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23fe3ad926d52dc9f2a565d23846e10b16dcd0a3df45747d394bc5cb3b1c468b |
|
MD5 | 3ee8bc1e11eab38058be8093d221dcb3 |
|
BLAKE2b-256 | 4d69d855a7ecb1a2c2083c763b34785c71c361beb4a7e47f62e4c902ccb96b6a |
Provenance
File details
Details for the file svglib-0.6.0-py2.5.egg
.
File metadata
- Download URL: svglib-0.6.0-py2.5.egg
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fe35b9e576b7f4f1589d3418291a034f193a2b63ccf791a30240c616fc241eb |
|
MD5 | 1243108af5cee3be5bf6e66378159e15 |
|
BLAKE2b-256 | bbe42e93863679b32a4226b3ef0c6e3ee1026f5355f26ea1b020f280e6d48fef |