高级前端
dom
【Q430】如何把 DOM 转化为图片

如何把 DOM 转化为图片

更多描述 可参考npm package

  1. html2canvas (opens in a new tab): Screenshots with JavaScript
  2. dom-to-image (opens in a new tab): Generates an image from a DOM node using HTML5 canvas

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 437 (opens in a new tab)

Author 回答者: markgong-gd (opens in a new tab)

https://www.zhangxinxu.com/study/201708/svg-foreignobject-dom-to-image.html (opens in a new tab) 看到这样一篇文章

Author 回答者: shfshanyue (opens in a new tab)

DOM -> SVG -> Canvas -> JPEG/PNG

Author 回答者: Kiera569 (opens in a new tab)

核心 foreignObject