A Simple Guide to Python Convert SVG to PDF with SvgLib – Python Tutorial

By | August 27, 2019

Python svglib can allow us to convert svg file to png and pdf, in this tutorial, we will introduce how to convert a svg to pdf file, you can do by following our steps.

convert svg to pdf

If you want to convert svg to png, you can read this tutorial.

Best Practice to Python Convert SVG to PNG with SvgLib – Python Tutorial

Import library

from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF, renderPM

Load svg file

drawing = svg2rlg("home.svg")

Convert svg to pdf file

renderPDF.drawToFile(drawing, "file.pdf")