How to load a HTML file into canvas?

后端 未结 3 594
天涯浪人
天涯浪人 2021-01-03 10:44

I know we can load an image into a canvas but I wonder if we are able to load a simple HTML file into a canvas. If yes, how?

Thanks.

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-03 11:16

    html2canvas or rasterizeHTML.js seem the tools you are looking for.

    A third solution without plugins is presented by Mozilla, but I could not get it running here: Although it's not trivial (for security reasons), it's possible to draw DOM content—such as HTML—into a canvas.

    There is also PhantomJS, which supports Screen Capturing

提交回复
热议问题