I am trying to convert an SVG file to PDF in python using the svglib
and reportlab
packages. Here is the SVG file.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="blue" />
</svg>
Here is the code I am using to convert (got this from svglib
webpage).
>>> from svglib.svglib import svg2rlg
>>> from reportlab.graphics import renderPDF
>>> drawing = svg2rlg("file.svg")
>>> renderPDF.drawToFile(drawing, "file.pdf")
The code runs fine without any error or exception but the file.pdf
thus generated is a blank file. I mean that when I open this PDF file I see nothing but only white background page with nothing on it.
Where am I going wrong ?