У меня строка содержащая svg
тег(не нода). Как мне её сохранить в base64
? Данную строку формирует Maker.js. Есть похожий вопрос тут, но там ноду передовать необходимо.
Результат в html
:
<svg width="400" height="400" viewBox="-10 -10 220 220" style="padding : 10px" xmlns="http://www.w3.org/2000/svg"><g id="svgGroup" stroke-linecap="round" fill-rule="evenodd" font-size="9pt" stroke="green" stroke-width="0.5mm" fill="none" style="stroke:green;stroke-width:0.5mm;fill:none"><g id="0"><g id="trapeze"><line id="line1" data-route="["models","trapeze","paths","line1"]" x1="0" y1="200" x2="200" y2="200" vector-effect="non-scaling-stroke"></line><line id="line2" data-route="["models","trapeze","paths","line2"]" x1="200" y1="200" x2="175" y2="0" vector-effect="non-scaling-stroke"></line><line id="line3" data-route="["models","trapeze","paths","line3"]" x1="175" y1="0" x2="25" y2="0" vector-effect="non-scaling-stroke"></line><line id="line4" data-route="["models","trapeze","paths","line4"]" x1="25" y1="0" x2="0" y2="200" vector-effect="non-scaling-stroke"></line></g></g></g></svg>
Результат Maker.js
:
<svg width="400" height="400" viewBox="-10 -10 220 220" style="padding : 10px" xmlns="http://www.w3.org/2000/svg"><g id="svgGroup" stroke-linecap="round" fill-rule="evenodd" font-size="9pt" stroke="green" stroke-width="0.5mm" fill="none" style="stroke:green;stroke-width:0.5mm;fill:none"><g id="0"><g id="trapeze"><line id="line1" data-route="["models","trapeze","paths","line1"]" x1="0" y1="200" x2="200" y2="200" vector-effect="non-scaling-stroke"/><line id="line2" data-route="["models","trapeze","paths","line2"]" x1="200" y1="200" x2="175" y2="0" vector-effect="non-scaling-stroke"/><line id="line3" data-route="["models","trapeze","paths","line3"]" x1="175" y1="0" x2="25" y2="0" vector-effect="non-scaling-stroke"/><line id="line4" data-route="["models","trapeze","paths","line4"]" x1="25" y1="0" x2="0" y2="200" vector-effect="non-scaling-stroke"/></g></g></svg>
Ошибка: