--- id: svglib version: "2.2.0" license: LGPL-3.0-or-later license_treatment: copyleft maintenance: active --- # svglib — A pure-Python library for reading and converting SVG License: copyleft · Maintenance: active · Downloads: 5.9M/mo ## 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 above — verify before relying. Svglib reads SVG files and converts them to ReportLab Drawing objects, which can then be rendered to PDF, bitmap, or other formats supported by ReportLab. 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 pip install svglib uv add svglib poetry add svglib ## Installing svglib 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. 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") Requires Python 3.9 or later. Bitmap output requires an additional renderPM backend; PDF output does not. 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_current - Install friction: low - Maintenance: active - Downloads: 5.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags svg to pdf conversion, svg to reportlab drawing, svg file reader python, convert svg graphics, svg rendering library, graphics-conversion, pdf-generation, svg-processing [View on SkillFed](https://skillfed.io/packages/svglib) · [View on PyPI](https://pypi.org/project/svglib/)