Can html2canvas render svg in a page?

后端 未结 1 1913
囚心锁ツ
囚心锁ツ 2021-01-04 18:01

I am using html2canvas to create a \'screenshot\' of a HTML page that contains SVG. Everything looks good, except the element. I know that it should be possible to render S

相关标签:
1条回答
  • 2021-01-04 18:34

    Capturing SVG images works by transforming them into canvas, using canvg. Include both javascript files as indicated on that page. Then the easiest way to do this is:

    <body onload="canvg()">
    

    See the parameterless call example. When all SVG images have been converted, html2canvas works flawlessly.

    Of course, all SVG images will be converted to canvases, but I did not see a difference.

    0 讨论(0)
提交回复
热议问题