CefSharp获取页面截图 [英] CefSharp get screenshot of a page

查看:1208
本文介绍了CefSharp获取页面截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 CefSharp 来获取网页的屏幕截图?我发现了有关 GetImage()方法的信息,但似乎不再受支持。还有其他办法吗?我需要从屏幕外的浏览器获取屏幕截图,因此制作显示浏览器的屏幕截图不是解决方案。

Is it possible to get screenshot of a web page using CefSharp? I have found information about GetImage() method but it seems to be not supported anymore. Is there any other way? I need to get screenshots from off-screen browser so making screenshot of a screen with browser displayed is not a solution.

推荐答案

I已在分支的 https://github.com/ivan-sam/CefSharp。此实现取决于另一个提交,该提交可修复脚本评估错误 https://github.com/cefsharp/CefSharp / issues / 445 ,所以请克隆或下载整个分支。

I've implemented this feature in a forked branch https://github.com/ivan-sam/CefSharp. This implementation depends on a another commit that fixes script evaluation bug https://github.com/cefsharp/CefSharp/issues/445 , so please clone or download the whole branch.

我修改了CefSharp.Wpf.Example项目,并添加了可创建快照的Snapshot按钮

I've modified CefSharp.Wpf.Example project and added Snapshot button that makes snapshot of the page and opens an image.

如果需要在WinForms应用程序中使用此功能,则可以使用 ElementHost

If you need to use this feature in WinForms app you can host WPF control with ElementHost

这篇关于CefSharp获取页面截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆