JSFiddle - React, Tailwind, and code Playground

HTML

<div data-v-690cd059="" class="preview">
                <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" width="355" height="260" class="ks-canvas-container" viewBox="0 0 7200 12800" background="#ffffff">
                 
                    <g class="colorbg background"> <rect width="7200" height="12800" fill="#ffffff"></rect></g><desc>Created with Snap</desc><defs></defs><g objectid="52924384-da22-4819-bcd4-366f56ff81b9" data-x="3719.753976051001" data-y="9834.544197539459" data-w="2410" data-h="480" class="element son text h1" transform="translate(3719.75,9834.54)" index="0" style="opacity: 0.5;"><g ffamily="SimHei" fontbold="0" fsize="480" fstyle="normal" linespace="0" fontspace="0" fontalign="center" fontcolor="#333333" fontcontent="添加正标题" ispathfont="true" class="fontData"></g><g opacity="1" class="paragraph">
                 <foreignObject width="2410" height="480" x="0" y="0">
                    <a href="#52924384-da22-4819-bcd4-366f56ff81b9" class="bsl-a-text" style="text-decoration: unset;">
                        <div xmlns="http://www.w3.org/1999/xhtml" contenteditable="false" id="id_52924384-da22-4819-bcd4-366f56ff81b9" textid="52924384-da22-4819-bcd4-366f56ff81b9" style="font-size:480px;
                                 text-align: center;
                                 text-decoration:undefined;
                                 font-feature-settings:&quot;liga&quot; 0;
                                 letter-spacing:0px;
                                 color:#333333;
                                 line-height:480px;
                                 font-style:normal;
                                  -webkit-user-select: text;
                                 font-family: &quot;SimHei&quot;;" class="initDiv">添加正标题 </div>
                     </a>
                  </foreignObject>
                </g></g><g objectid="70931dc2-7a73-4053-b8db-7ebb80ade69a" data-x="2395" data-y="4267" data-w="2410" data-h="480"...

JavaScript

//Front end
         const rawResponse = await fetch('http://localhost:3002/convert', {
                    method: 'POST',
                    headers: {
                        'Accept-Charset': 'utf-8',
                        'Accept': 'application/json;charset=utf-8',
                        'Content-Type': 'application/json;charset=utf-8'
                    },
                    body:JSON.stringify({svg: $('.preview').html()})
                });

//Nodejs
const { convert } = require('convert-svg-to-png');
const utf8 = require('utf8');
console.log('body', req.body.svg);
//Post
const png = await convert(utf8.encode(req.body.svg));