How to get HTML path from user-uploaded SVG?

Hi there,

Does anyone know how to convert an svg file into its underlying code? I need to do this automatically (ideally as a workflow, javascript or HTML embed) because the SVG file is user-uploaded and session-specific.


1 Like

So you need the <svg viewBox='0 0 105 93' xmlns=''> <path d='M66,0h39v93zM38,0h-38v93zM52,35l25,58h-16l-8-18h-18z' fill='#ED1C24'/> </svg> text from an already uploaded svg file?

Hey Huseyin - that’s right. Ultimately, I am doing this because I want to be able to manipulate the colour of the SVG dynamically, and then have the user able to download the result. The solution also needs to involve rendering the SVG in an HTML embed element because I’ve found that the image element renders the SVG incorrectly.

The furthest I can do is to display the SVG in HTML element :slight_smile: I still couldn’t figure out to get the textual version of the SVG.

Nice try! I managed to do the same, but can’t work out how I’d manipulate the colour.

This topic was automatically closed after 70 days. New replies are no longer allowed.