【问题标题】:Capture screenshot of iframe - html2canvas not working捕获 iframe 的屏幕截图 - html2canvas 无法正常工作
【发布时间】:2015-01-22 09:08:12
【问题描述】:

我有以下 iframe:

<iframe name="content" src="" style="position: absolute; left: 0px; top: 28px;" allowtransparency="true" border="0" scrolling="yes" width="100%" frameborder="0" height="90%" id="MyFrame"></iframe>

我只是想捕获 iframe 内容的屏幕截图,我已经尝试过 html2canvas,但它似乎不起作用。我尝试将 iframe 放在 div 中,但没有任何乐趣。

我已经看到了使用 php 实现此目的的各种方法,但似乎没有什么清楚的。任何人都可以解释一下吗?

【问题讨论】:

    标签: javascript php html iframe html2canvas


    【解决方案1】:

    它写在文档的限制部分:http://html2canvas.hertzen.com/documentation.html#limitations

    脚本不呈现插件内容,例如 Flash 或 Java 小程序。它也不呈现 iframe 内容。

    使用 JS 截屏会引发安全问题。

    最近我一直在尝试 carota (https://github.com/danielearwicker/carota) 在画布上呈现 HTML 文本并取得了一些成功。但是,它只处理一小部分 HTML。

    还有 SVG foreignobjectapproach 可以在画布中渲染 DOM 对象:https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas

    很遗憾,它没有在 IE 中实现,包括 IE 11。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-30
      • 2015-05-16
      • 1970-01-01
      相关资源
      最近更新 更多