Im using svglib to render my svg files (rendered from a template) in django.
There seems to be a problem with how the library resolves the path of the image when rendering.
I was wondering if anyone has implemented this or knows a better way to convert svg (that includes images) to PDF?
EDIT:
My view:
def certificate_image(response, id, output):
...
...
data = certificate_template.render(c)
if output == 'pdf':
doc = xml.dom.minidom.parseString(data)
svg = doc.documentElement
svgRenderer = SvgRenderer()
svgRenderer.render(svg)
drawing = svgRenderer.finish()
buffer = StringIO()
renderPDF.drawToFile(drawing, buffer)
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; filename=certificate.pdf'
pdf = buffer.getvalue()
buffer.close()
response.write(pdf)
return response
What about SVG to HTML? It depends what SVG you are converting but sometimes the results are identical.
Let me know if this is relevant and helps or if you have any query.
Go the instruction page where the tool is also located.
http://irunmywebsite.com/raphael/svgsource.php