I have an svg file and I want to insert other svg object inside this existent.
import svgwrite
dwg = svgwrite.Drawing('model.svg')
square = dwg.add(dwg.rect(20,20),(80,80), fill='blue'))
dwg.save()
it returns a new file with this shape ignoring my previous file. How could I write this?
Thank's
The
svgwrite
library doesn't support this -- its purpose is to create new SVG files, not work with existing ones. Looking at the source for theDrawing
class, you can see that when you save your drawing, it opens the file for writing and truncates; anything that was previously in that file is lost as a result:I found a module to do that
I hope that works for you too.