JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<h3>Original Svg</h3>
	<svg id="svgData" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" text-anchor="middle" viewBox="0 0 1584 648">
	    <style>
	        @import url("https://fonts.googleapis.com/css2?family=Ms+Madi&amp;family=PT+Sans&amp;Roboto+Condensed");
	    .Rrrrr { fill: red; }
		</style>
		<!-- This text we allow to be changed. this is personalization id #1  -->
	    <text font-family="Ms Madi" x="987" y="90" font-size="40" class="personalization personalization_text_1">Font to be changed</text>
	    <text font-family="Ms Madi" x="987" y="350">
	    </text>
		<!-- This text below the customer cannot edit	-->
		<g id="MAIN_PIC" xmlns:zcc="http://www.zund.com/ZCC" zcc:date="2022-03-16T17:10:52" zcc:version="3.1.6.28469">
		<rect style="fill:none;stroke:#000000;stroke-miterlimit:10;" width="1584" height="648"></rect>
	</g>
	</svg>

	<br><br><br><br><br><br>
<hr>
<h3>Canvas preview</h3>
	<canvas id="canvas1" ></canvas>
</body>
</html>

JavaScript

drawPrevCanvas();
	function drawPrevCanvas() {
  	var svg = document.getElementById('svgData');

	  var xml = new XMLSerializer().serializeToString(svg);
	  var svg64 = btoa(xml);
	  var b64Start = 'data:image/svg+xml;base64,';
	  var image64 = b64Start + svg64;
	  
	  var hcanvas_prev_3 = document.getElementById('canvas1');
	  var ctx3 = hcanvas_prev_3.getContext("2d");
	  
	  var svgImgPrev = new Image();
	  svgImgPrev.crossOrigin = "Anonymous";
	  hcanvas_prev_3.width = 400;
	  hcanvas_prev_3.height = 164;

	  svgImgPrev.onload = function() {
	    ctx3.drawImage(svgImgPrev, 0, 0, 400, 164);
	  }
	  svgImgPrev.src = image64;
	}