canvg playground

https://github.com/canvg/canvg

by Arvind Pal

HTML

<script src="https://unpkg.com/[email protected]/lib/umd.js"></script>
<canvas></canvas>

JavaScript

window.onload = () => {

    const canvas = document.querySelector('canvas');
    const ctx = canvas.getContext('2d');
    
    v = canvg.Canvg.fromString(ctx, '<svg width="600" height="600"><text x="50" y="50">Hello Worldwewerwer!</text></svg>');

    // Start SVG rendering with animations and mouse handling.
    v.start();

};