svglib
A pure-Python library for reading and converting SVG
Decision gist · record as of 2026-08-14
Yes. Svglib is actively maintained, has no known vulnerabilities, low install friction, and solves SVG-to-PDF/bitmap conversion well for most common use cases. The LGPL-3.0-or-later license is copyleft, so disclose modifications if you distribute derivatives. Known limitations (no @import, no mask elements, limited CSS) are documented; verify they don't block your specific SVG files.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Bitmap output requires an additional renderPM backend; PDF output does not.
- Low install friction: pure Python wheel with five runtime dependencies.
License · maintenance · safety
LGPL-3.0-or-later (copyleft) — Licensed under LGPL-3.0-or-later (copyleft). You must disclose source code modifications and make the library available under the same license if you distribute derivative works.
last release 2026-08-14 (0 days) · last repo commit 2026-08-14 · 373 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 5,940,849 downloads/mo, #2,006 on PyPI
Alternatives
Verify before relying
pip install svglib
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF
drawing = svg2rlg("file.svg")
renderPDF.drawToFile(drawing, "file.pdf")- Whether CSS attribute support covers the specific stylesheets in your SVG files
- Performance characteristics for large or complex SVG files
- Behavior when SVG files use unsupported features (@import rules, mask elements, ForeignObject)
What it is and what it does
Svglib is a pure-Python library that reads SVG files (plain or compressed) and converts them into ReportLab Drawing objects. These objects can then be rendered to PDF, EPS, SVG, or bitmap formats. The library handles SVG gradients, conditional rendering, and clip paths, though it has known limitations around CSS imports, mask elements, and ForeignObject support.
You can use it as a Python package to programmatically convert SVG to other formats, or as a command-line tool (svg2pdf) to batch-convert SVG files to PDF from the shell. It supports Python 3.9+ and PyPy3, with dependencies on reportlab, lxml, pillow, cssselect2, and tinycss2.
Use it for
- Convert SVG graphics to PDF for document generation or archival
- Embed SVG images in ReportLab-based PDF reports or Platypus documents
- Batch-convert SVG files to PDF from the command line using the svg2pdf tool
- Render SVG to bitmap formats via ReportLab's renderPM backend
- Build tools that need to programmatically transform vector graphics to print-ready formats
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Svglib is actively maintained, has no known vulnerabilities, low install friction, and solves SVG-to-PDF/bitmap conversion well for most common use cases. The LGPL-3.0-or-later license is copyleft, so disclose modifications if you distribute derivatives. Known limitations (no @import, no mask elements, limited CSS) are documented; verify they don't block your specific SVG files.
Install
svglib on PyPI
Before you install
Low install friction: pure Python wheel with five runtime dependencies. Actively maintained as of 2026-08-14 with no known security vulnerabilities.
Requires Python 3.9 or later. Bitmap output requires an additional renderPM backend; PDF output does not.
License in practice
Licensed under LGPL-3.0-or-later (copyleft). You must disclose source code modifications and make the library available under the same license if you distribute derivative works.
Quickstart
pip install svglib
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF
drawing = svg2rlg("file.svg")
renderPDF.drawToFile(drawing, "file.pdf")
Verify before relying
- Whether CSS attribute support covers the specific stylesheets in your SVG files
- Performance characteristics for large or complex SVG files
- Behavior when SVG files use unsupported features (@import rules, mask elements, ForeignObject)
Package facts
| License | LGPL-3.0-or-later copyleft |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagescssselect2lxmlpillowreportlabtinycss2 |
| Maintenance | Actively maintained 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,940,849 / month, #2,006 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Natural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: DocumentationTopic :: Multimedia :: Graphics :: Graphics ConversionTopic :: PrintingTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Markup :: XMLTopic :: Utilities |
Evidence: svglib-2.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “svg to pdf conversion”
- svglibSvglib reads SVG files and converts them to ReportLab Drawing…
- CairoSVGCairoSVG converts SVG files to PDF, EPS, PS, and PNG formats using…
- sphinxcontrib-svg2pdfconverterConverts SVG images to PDF or PNG for Sphinx documentation builders…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also CairoSVG · svgutils · aggdraw · svgwrite · svg.py · svgelements · rlPyCairo · drawsvg · sphinxcontrib-svg2pdfconverter · potracer