Is it possible to convert the below SVG code into Canvas or Image format using js.
<svg class="svg" id="myViewer" width="400" height="250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<g transform="translate(0, 0)" stroke="#000000" fill="#ffffff" stroke-width="1">
<foreignObject style="overflow:visible;" pointer-events="all" width="100%" height="100%">
<div contenteditable="true" style="height:10%">Sample</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%">
<image x="0" y="0" width="100%" height="100%" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://cdn2.iconfinder.com/data/icons/circle-icons-1/64/focus-48.png"></image>
<rect x="0" y="0" width="100%" height="10" pointer-events="all" fill="green"/>
</svg>
</foreignObject>
</g>
</svg>
<canvas id="canvas"></canvas>