Hi there,
I am trying to convert a bunch of svg files to pdf, using the svglib and reportlab python packages.
I am using a small program, that I found in a neighboring thread (
Convert SVG to PDF in python[
^] )
So, after assembling the converter looks like this:
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF
drawing = svg2rlg("file.svg")
renderPDF.drawToFile(drawing, "file.pdf")
I tested it with the following svg file:
="1.0"="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" height="1000.0" width="1000.0">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="blue" />
</svg>
Works like a charm.
My real file is this one:
="1.0"="utf-8"
<svg baseProfile="full" height="210.0" version="1.1" viewBox="0,0,297.0,210.0" width="297.0" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"><![CDATA[</style></defs><g class="whitesquare"><rect height="35" width="35" x="8.5" y="35.0" /><rect height="35" width="35" x="8.5" y="105.0" /><rect height="35" width="35" x="8.5" y="175.0" /><rect height="35" width="35" x="43.5" y="0.0" />><rect height="35" width="35" x="253.5" y="0.0" /><rect height="35" width="35" x="253.5" y="70.0" /><rect height="35" width="35" x="253.5" y="140.0" /></g><g class="blacksquare"><rect height="35" width="35" x="8.5" y="0.0" /><rect height="35" width="35" x="8.5" y="70.0" /><rect height="35" width="35" x="8.5" y="140.0" /><rect height="35" width="35" x="253.5" y="175.0" /></g><g class="whitesquare"><rect height="17.5" width="297.0" x="0" y="0" /><rect height="17.5" width="297.0" x="0" y="192.5" /><rect height="210.0" width="26.0" x="0" y="0" /><rect height="210.0" width="26.0" x="271.0" y="0" /></g></svg>
No luck here, just a blank pdf file.
Where am I wrong?
I am thankful for any hint! Please tell me if you need more information.
Thanks in advance!