0

I need to be able to edit the text and images of an SVG file that has been rendered in Adobe Illustrator.

How can I iterate through the elements of an SVG file, check for type = text, change the value, and save the file to disk? Is there any library available that could help me?

So far I've tried this basic library but it doesn't do well with complex SVG structures.

notAnonymousAnymore
  • 2,637
  • 9
  • 49
  • 74

2 Answers2

1

SVG RENDERING ENGINE

I used this one for a project. There were a few flaws but it did the job.

BBQ
  • 618
  • 1
  • 7
  • 20
1

This may be very late to answer but for the sake of others if they land in this page, You can use HTMLAgilityPack. Here is the link to a similar question: What is the best way to parse html in C#?

I have used it in my case where i needed to edit the svg string and replace some values like this:

 HtmlDocument theDocument = new HtmlDocument();
    theDocument.LoadHtml(svgChartImg1);

    HtmlNodeCollection theNodes = theDocument.DocumentNode.SelectNodes("//tspan");

Here, the svgChartImg1 is an svg xml string.

Community
  • 1
  • 1
johnsabre
  • 355
  • 2
  • 7