Search code examples
d3.jssvgadobe-illustrator

is there a way to convert svg <line> to svg <path> in illustrator?


I have a coworker using Illustrator to merge 2 svgs. 1 svg was using several <path> elements but these were converted to <line> elements. I know there's a general algorithm for converting and svg <line> to an svg <path>. For example, here's an example of doing that using D3.js:

https://www.dashingd3js.com/svg-paths-and-d3js

However, I was wondering if there was a more native way of doing this directly in Illustrator, through an Illustrator plugin or through some type of third party automated tool?


Solution

  • You could make this, turning lines into compound path (right click + Make Compound Path). That change this:

    <line fill="none" stroke="#000000" stroke-miterlimit="10"
        x1="216.935" y1="158.508" x2="661.196" y2="166.705"/>
    

    to this:

    <path fill="none" stroke="#000000" stroke-miterlimit="10"
         d="M661.196,166.705l-444.262-8.197"/>
    

    Hope this help.