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.

This release accesses 199 flags from Wikipedia.org for test purposes.

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?

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.2.tar.gz (551.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

svglib-0.6.2-py2.6.egg (27.5 kB view details)

Uploaded Egg

svglib-0.6.2-py2.5.egg (27.6 kB view details)

Uploaded Egg

File details

Details for the file svglib-0.6.2.tar.gz.

File metadata

  • Download URL: svglib-0.6.2.tar.gz
  • Upload date:
  • Size: 551.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for svglib-0.6.2.tar.gz
Algorithm Hash digest
SHA256 90d2a0be5725334f2c319d7103005e83371186b8e4cddb687f23733e004e4e8f
MD5 a86e3db61e8bf85b318c815dc60aed1b
BLAKE2b-256 115df3040bcd6353bf2bcc5eadec86cbda3ee7f2e4cbd1e588564bc9fdf07f73

See more details on using hashes here.

File details

Details for the file svglib-0.6.2-py2.6.egg.

File metadata

  • Download URL: svglib-0.6.2-py2.6.egg
  • Upload date:
  • Size: 27.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for svglib-0.6.2-py2.6.egg
Algorithm Hash digest
SHA256 a3e2170d4af5f3f72de6d41f137fc50957cdcc8b18c6842ceb85e72c29ca918e
MD5 7677c093bb57534ec88b0307634508c4
BLAKE2b-256 ee9000a2d4afe5d7f687a5f4d62d1fcff46d3ac2ba92fa106f27a91c7abdbbc5

See more details on using hashes here.

File details

Details for the file svglib-0.6.2-py2.5.egg.

File metadata

  • Download URL: svglib-0.6.2-py2.5.egg
  • Upload date:
  • Size: 27.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for svglib-0.6.2-py2.5.egg
Algorithm Hash digest
SHA256 ae8d5ac0ed5dd884892275583b2588076e8f6802c27fb9a503ab98c930668cd1
MD5 dc6b37918b6e9e9e5e39751a141a8856
BLAKE2b-256 fa2779839a4c149e1a878614af4596f60317f1f0c373e9b3a757f1a673ee9950

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page